## 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 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).

Version:
  1.0
Author:
  Dennis M. Sosnoski

Method Summary
`boolean` `isExtension(int index)` 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(int index)

  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:
    `index` - abstract mapping index to be checked
  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 |