org.jibx.runtime
Interface IMarshaller

All Known Subinterfaces:
IAbstractMarshaller
All Known Implementing Classes:
DiscardElementMapper, DiscardListMapper, Dom4JElementMapper, Dom4JListMapper, DomElementMapper, DomFragmentMapper, DomListMapper, HashMapperStringToComplex, HashMapperStringToSchemaType, IdDefRefMapperBase, IdRefMapperBase, ObjectArrayMapper, TypedArrayMapper

public interface IMarshaller

Marshaller interface definition. This interface must be implemented by the handler for marshalling an object.

Instances of classes implementing this interface must be serially reusable, meaning they can store state information while in the process of marshalling an object but must reset all state when called to marshal another object after the first one is done (even if the first object throws an exception during marshalling). The JiBX framework will only create one instance of a marshaller class (per marshalling context) for each mapped class using that marshaller. Generally the marshaller instance will not be called recursively, but this may happen in cases where the binding definition includes recursive mappings and the marshaller uses other marshallers (as opposed to handling all children directly).

Author:
Dennis M. Sosnoski

Method Summary
 boolean isExtension(java.lang.String mapname)
          Check if marshaller represents an extension mapping.
 void marshal(java.lang.Object obj, IMarshallingContext ctx)
          Marshal instance of handled class.
 

Method Detail

isExtension

boolean isExtension(java.lang.String mapname)
Check if marshaller represents an extension mapping. This is used by the framework in generated code to verify compatibility of objects being marshalled using an abstract mapping.

Parameters:
mapname - marshaller mapping name (generally the class name to be handled, or abstract mapping type name)
Returns:
true if this mapping is an extension of the abstract mapping, false if not

marshal

void marshal(java.lang.Object obj,
             IMarshallingContext ctx)
             throws JiBXException
Marshal instance of handled class. This method call is responsible for all handling of the marshalling of an object to XML text. It is called at the point where the start tag for the associated element should be generated.

Parameters:
obj - object to be marshalled (may be null if property is not optional)
ctx - XML text output context
Throws:
JiBXException - on error in marshalling process


Project Web Site