Class TLcdXMLSchemaBasedMarshallerProvider

java.lang.Object
com.luciad.format.xml.bind.TLcdXMLMarshallerProvider
com.luciad.format.xml.bind.schema.TLcdXMLSchemaBasedMarshallerProvider

public class TLcdXMLSchemaBasedMarshallerProvider extends TLcdXMLMarshallerProvider
Extended TLcdXMLMarshallerProvider that creates marshallers on-the-fly using a TLcdXMLSchemaBasedEncoder's type marshaller provider. It also allows to register and retrieve marshallers for local elements.
  • Constructor Details

    • TLcdXMLSchemaBasedMarshallerProvider

      public TLcdXMLSchemaBasedMarshallerProvider(TLcdXMLSchemaBasedEncoder aEncoder)
      Creates a new marshaller provider for the given encoder.
      Parameters:
      aEncoder - the encoder whose type marshaller provider will be used.
  • Method Details

    • registerMarshaller

      public <T> void registerMarshaller(QName aXMLElementName, Class<T> aJavaClass, ILcdXMLMarshaller<? super T> aMarshaller)
      Description copied from class: TLcdXMLMarshallerProvider
      Registers an ILcdXMLMarshaller which is capable of marshalling the specified Java class to the specified XML element.

      The XML element name should be unique. Therefore, in the context of XML Schema, only marshallers for global elements should be registered on this provider (local elements are not guaranteed to be unique).

      Overrides:
      registerMarshaller in class TLcdXMLMarshallerProvider
      Parameters:
      aXMLElementName - the XML element to which the marshaller can marshal the Java instances.
      aJavaClass - the Java class which is marshalled to the specified XML element.
      aMarshaller - the marshaller to be registered.
    • getMarshaller

      public <T> ILcdXMLMarshaller<? super T> getMarshaller(TLcdXMLSchemaElementIdentifier aElementId, Class<T> aJavaClass)
      Gets a marshaller for the given element and class. This method is typically used for elements for which no substitution is possible. If no marshaller was registered for the given element and class, returns an adapter around the corresponding type marshaller.
      Parameters:
      aElementId - the identifier of the element that the resulting marshaller should be able to marshal
      aJavaClass - the class of which instances should be marshalled by the resulting marshaller
      Returns:
      a marshaller for the given element identifier and class
    • registerMarshaller

      public <T> void registerMarshaller(TLcdXMLSchemaElementIdentifier aElementId, Class<T> aJavaClass, ILcdXMLMarshaller<? super T> aMarshaller)
      Registers a marshaller for the given element and java class.
      Parameters:
      aElementId - the identifier of the element for which the marshaller is to be registered
      aJavaClass - the class of which instances are marshalled
      aMarshaller - the marshaller for the given element identifier and class
    • getMarshaller

      public <T> ILcdXMLMarshaller<? super T> getMarshaller(QName aXMLGlobalElementName, Class<T> aJavaClass)
      Description copied from class: TLcdXMLMarshallerProvider
      Returns a marshaller which is capable of marshalling instances of the specified Java class into instances of the specified XML element.
      Overrides:
      getMarshaller in class TLcdXMLMarshallerProvider
      Parameters:
      aXMLGlobalElementName - the XML element to which the marshaller should marshal the Java instances, or null if it is unspecified (a marshaller which can marshal the specified Java class will be returned in this case, but it is unspecified to which element it will marshal).
      aJavaClass - the Java class of the instances to be marshalled.
      Returns:
      a marshaller for marshalling instances of the specified Java class to instances of the specified XML element. If no such marshaller was found, null is returned.