Class TLcdXMLTypeMarshallerProvider

java.lang.Object
com.luciad.format.xml.bind.schema.TLcdXMLTypeMarshallerProvider

public class TLcdXMLTypeMarshallerProvider extends Object
Provider of ILcdXMLTypeMarshaller's and ILcdXMLSchemaDatatypeMarshaller's that can marshal instances of a specified Java class to instances of an XML element with a specified XML Schema type or datatype.

This provider maintains two lookup tables:

  • a lookup table from each [XML Schema type, Java class] pair to its corresponding type marshaller
  • a lookup table from each [XML Schema simple type, Java class] pair to its corresponding datatype marshaller

Please refer to the com.luciad.format.xml.bind package documentation for a general overview of the XML Binding Framework.

Since:
9.0
See Also:
  • Method Details

    • registerTypeMarshaller

      public <T> void registerTypeMarshaller(TLcdXMLSchemaTypeIdentifier aTypeId, Class<? extends T> aJavaClass, ILcdXMLTypeMarshaller<T> aMarshaller)
      Registers an ILcdXMLTypeMarshaller which is capable of marshalling instances of a specified Java class to instances of an XML element of the specified XML Schema type.
      Parameters:
      aTypeId - the XML Schema Type for which to register the marshaller.
      aJavaClass - the Java class which instances the specified marshaller can marshal.
      aMarshaller - the marshaller to be registered.
      Throws:
      NullPointerException - if one of the arguments is null.
    • getTypeMarshaller

      public <T> ILcdXMLTypeMarshaller<? super T> getTypeMarshaller(TLcdXMLSchemaTypeIdentifier aTypeId, Class<T> aJavaClass)
      Returns the marshaller which is capable of marshalling instances of the specified Java class to instances of an XML element of the specified XML Schema type.
      Parameters:
      aTypeId - the XML Schema type for which to register the marshaller.
      aJavaClass - the Java class which instances the marshaller should marshal.
      Returns:
      the marshaller which is capable of marshalling instances of the specified Java class to instances of an XML element of the specified XML Schema type, or null if no such marshaller was found.
      Throws:
      NullPointerException - if one of the arguments is null.
    • getTypeMarshaller

      public <T> ILcdXMLTypeMarshaller<? super T> getTypeMarshaller(TLcdXMLSchemaTypeIdentifier aTypeId, Class<T> aJavaClass, boolean aAllowClassSubstitution)
      Returns the marshaller which is capable of marshalling instances of the specified Java class to instances of an XML element of the specified XML Schema type.
      Parameters:
      aTypeId - the XML Schema type for which to register the marshaller.
      aJavaClass - the Java class which instances the marshaller should marshal.
      aAllowClassSubstitution - if true, this marshaller provider will also search for marshallers for super classes and/or interfaces of the specified Java class, if no marshaller could be found for the specified class itself. The TLcdXMLJavaClassResolver of this provider is used to determine for which super classes and/or interfaces to search, and in which order.
      Returns:
      the marshaller which is capable of marshalling instances of the specified Java class to instances of an XML element of the specified XML Schema type, or null if no such marshaller was found.
      Throws:
      NullPointerException - if one of the arguments is null.
    • registerDatatypeMarshaller

      public <T> void registerDatatypeMarshaller(TLcdXMLSchemaTypeIdentifier aTypeId, Class<? extends T> aJavaClass, ILcdXMLDatatypeMarshaller<T> aMarshaller)
      Registers an ILcdXMLDatatypeFormatter which is capable of formatting instances of the specified Java class to lexical representations of the corresponding XML value of the specified XML datatype.
      Parameters:
      aTypeId - the XML Schema simple type for which to register the formatter.
      aJavaClass - the Java class which instances the specified formatter can format.
      aMarshaller - the formatter to be registered.
      Throws:
      NullPointerException - if one of the arguments is null.
    • getDatatypeMarshaller

      public <T> ILcdXMLDatatypeMarshaller<? super T> getDatatypeMarshaller(TLcdXMLSchemaTypeIdentifier aTypeId, Class<T> aJavaClass)
      Returns the datatype formatter which is capable of formatting instances of the specified Java class to lexical representations of the corresponding XML value of the specified XML datatype.
      Parameters:
      aTypeId - the XML Schema simple type of the returned marshaller
      aJavaClass - the Java class which instances the returned marshaller can marshal
      Returns:
      the datatype formatter which is capable of marshalling instances of the specified Java class to lexical representations of the corresponding XML value of the specified XML datatype, or null if no such marshaller was found.
      Throws:
      NullPointerException - if one of the arguments is null.
    • getTypeClasses

      public Set<Class<?>> getTypeClasses(TLcdXMLSchemaTypeIdentifier aTypeId)
      Returns for the specified XSD Schema type identifier a set of all Java classes for which a schema type marshaller is registered.
      Parameters:
      aTypeId - the XSD Schema type identifier for which to return the corresponding Java classes.
      Returns:
      a set of all Java classes for which a schema type marshaller is registered for the specified XSD Schema type.
    • getDatatypeClasses

      public Set<Class<?>> getDatatypeClasses(TLcdXMLSchemaTypeIdentifier aTypeId)
      Returns for the specified XSD Schema datatype identifier a set of all Java classes for which a schema type marshaller is registered.
      Parameters:
      aTypeId - the XSD Schema datatype identifier for which to return the corresponding Java classes.
      Returns:
      a set of all Java classes for which a schema type marshaller is registered for the specified XSD Schema datatype.
    • getTypeIdentifiers

      public Set<TLcdXMLSchemaTypeIdentifier> getTypeIdentifiers(Class<?> aClass)
      Returns for the specified Java class a set of all XSD Schema type identifiers for which a schema type marshaller is registered.
      Parameters:
      aClass - the XSD Schema type identifier for which to return the corresponding Java classes.
      Returns:
      a set of all XSD Schema type identifiers for which a schema type marshaller is registered for the specified Java class.
    • getDatatypeIdentifiers

      public Set<TLcdXMLSchemaTypeIdentifier> getDatatypeIdentifiers(Class<?> aClass)
      Returns for the specified Java class a Set of all XSD Schema datatype identifiers for which a schema type marshaller is registered.
      Parameters:
      aClass - the XSD Schema datatype identifier for which to return the corresponding Java classes.
      Returns:
      a set of all XSD Schema type identifiers for which a schema datatype marshaller is registered for the specified Java class.
    • 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