Package com.luciad.format.xml.bind
Class TLcdXMLMarshallerProvider
java.lang.Object
com.luciad.format.xml.bind.TLcdXMLMarshallerProvider
- Direct Known Subclasses:
TLcdXMLSchemaBasedMarshallerProvider
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 Summary
ConstructorDescriptionCreates a newTLcdXMLMarshallerProvider
.TLcdXMLMarshallerProvider
(TLcdXMLJavaClassResolver aJavaClassResolver) Creates a newTLcdXMLMarshallerProvider
. -
Method Summary
Modifier and TypeMethodDescription<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.<T> ILcdXMLMarshaller
<? super T> getMarshaller
(QName aXMLElementName, Class<T> aJavaClass, boolean aAllowClassSubstitution) <T> void
registerMarshaller
(QName aXMLElementName, Class<T> aJavaClass, ILcdXMLMarshaller<? super T> aMarshaller) Registers anILcdXMLMarshaller
which is capable of marshalling the specified Java class to the specified XML element.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.
-
Constructor Details
-
TLcdXMLMarshallerProvider
public TLcdXMLMarshallerProvider()Creates a newTLcdXMLMarshallerProvider
. -
TLcdXMLMarshallerProvider
Creates a newTLcdXMLMarshallerProvider
.- Parameters:
aJavaClassResolver
- thecom.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 anILcdXMLMarshaller
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 isnull
.
-
getMarshaller
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, ornull
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
- ifaJavaClass
isnull
.
-
getMarshaller
public <T> ILcdXMLMarshaller<? super T> getMarshaller(QName aXMLElementName, Class<T> aJavaClass, boolean aAllowClassSubstitution) -
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.
-