public class TLcdXMLMarshallerProvider extends Object
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.ILcdXMLMarshaller
,
TLcdXMLEncoder
Constructor and Description |
---|
TLcdXMLMarshallerProvider()
Creates a new
TLcdXMLMarshallerProvider . |
TLcdXMLMarshallerProvider(TLcdXMLJavaClassResolver aJavaClassResolver)
Creates a new
TLcdXMLMarshallerProvider . |
Modifier and Type | Method and Description |
---|---|
<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 an
ILcdXMLMarshaller which is capable of marshalling the specified Java class
to the specified XML element. |
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.
|
public TLcdXMLMarshallerProvider()
TLcdXMLMarshallerProvider
.public TLcdXMLMarshallerProvider(TLcdXMLJavaClassResolver aJavaClassResolver)
TLcdXMLMarshallerProvider
.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.public <T> void registerMarshaller(QName aXMLElementName, Class<T> aJavaClass, ILcdXMLMarshaller<? super T> aMarshaller)
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).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.NullPointerException
- if one of the arguments is null
.public <T> ILcdXMLMarshaller<? super T> getMarshaller(QName aXMLElementName, Class<T> aJavaClass)
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.null
is returned.NullPointerException
- if aJavaClass
is null
.public <T> ILcdXMLMarshaller<? super T> getMarshaller(QName aXMLElementName, Class<T> aJavaClass, boolean aAllowClassSubstitution)
public String toString()