Class TLcdXMLMarshallerProvider

java.lang.Object
com.luciad.format.xml.bind.TLcdXMLMarshallerProvider
Direct Known Subclasses:
TLcdXMLSchemaBasedMarshallerProvider

public class TLcdXMLMarshallerProvider extends Object
Provider of ILcdXMLMarshaller's that can marshal instances of a specified Java class to a specified XML element.

This provider maintains a lookup table from each [XML element, Java class] pair to its corresponding marshaller.

One TLcdXMLMarshallerProvider instance represents one set of marshallers which can delegate to each other and which, all together, should be capable of marshalling Java content tree to instances of one or more particular types of XML documents.

Please refer to the package documentation for a general overview of the XML Binding Framework.

Since:
8.2
See Also:
  • Constructor Details

    • TLcdXMLMarshallerProvider

      public TLcdXMLMarshallerProvider()
      Creates a new TLcdXMLMarshallerProvider.
    • TLcdXMLMarshallerProvider

      public TLcdXMLMarshallerProvider(TLcdXMLJavaClassResolver aJavaClassResolver)
      Creates a new TLcdXMLMarshallerProvider.
      Parameters:
      aJavaClassResolver - the com.luciad.format.xml.bind.TLcdXMLJavaClassResolver to be used by this provider in case it doesn't have a marshaller registred for a specified Java class, in which case it will search for marshallers for super classes or interfaces implemented by the specified class.
  • Method Details

    • registerMarshaller

      public <T> void registerMarshaller(QName aXMLElementName, Class<T> aJavaClass, ILcdXMLMarshaller<? super T> aMarshaller)
      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).

      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.
      Throws:
      NullPointerException - if one of the arguments is null.
    • getMarshaller

      public <T> ILcdXMLMarshaller<? super T> getMarshaller(QName aXMLElementName, Class<T> aJavaClass)
      Returns a marshaller which is capable of marshalling instances of the specified Java class into instances of the specified XML element.
      Parameters:
      aXMLElementName - 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.
      Throws:
      NullPointerException - if aJavaClass is null.
    • getMarshaller

      public <T> ILcdXMLMarshaller<? super T> getMarshaller(QName aXMLElementName, Class<T> aJavaClass, boolean aAllowClassSubstitution)
    • toString

      public String toString()
      Returns a general description of this provider, containing a list of all [XML Schema type, Java class] pairs with their corresponding marshaller and all [XML Schema simple type, Java class] pairs with their corresponding datatype formatter.

      The exact details of the representation are unspecified and are subject to change.

      Overrides:
      toString in class Object