public class TLcdXMLSchemaBasedMarshallerProvider extends TLcdXMLMarshallerProvider
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 and Description |
---|
TLcdXMLSchemaBasedMarshallerProvider(TLcdXMLSchemaBasedEncoder aEncoder)
Creates a new marshaller provider for the given encoder.
|
Modifier and Type | Method and Description |
---|---|
<T> ILcdXMLMarshaller<? super T> |
getMarshaller(QName aXMLGlobalElementName,
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(TLcdXMLSchemaElementIdentifier aElementId,
Class<T> aJavaClass)
Gets a marshaller for the given element and class.
|
<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. |
<T> void |
registerMarshaller(TLcdXMLSchemaElementIdentifier aElementId,
Class<T> aJavaClass,
ILcdXMLMarshaller<? super T> aMarshaller)
Registers a marshaller for the given element and java class.
|
getMarshaller, toString
public TLcdXMLSchemaBasedMarshallerProvider(TLcdXMLSchemaBasedEncoder aEncoder)
aEncoder
- the encoder whose type marshaller provider will be used.public <T> void registerMarshaller(QName aXMLElementName, Class<T> aJavaClass, ILcdXMLMarshaller<? super T> aMarshaller)
TLcdXMLMarshallerProvider
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).registerMarshaller
in class TLcdXMLMarshallerProvider
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.public <T> ILcdXMLMarshaller<? super T> getMarshaller(TLcdXMLSchemaElementIdentifier aElementId, Class<T> aJavaClass)
aElementId
- the identifier of the element that the resulting marshaller should be able to marshalaJavaClass
- the class of which instances should be marshalled by the resulting marshallerpublic <T> void registerMarshaller(TLcdXMLSchemaElementIdentifier aElementId, Class<T> aJavaClass, ILcdXMLMarshaller<? super T> aMarshaller)
aElementId
- the identifier of the element for which the marshaller is to be registeredaJavaClass
- the class of which instances are marshalledaMarshaller
- the marshaller for the given element identifier and classpublic <T> ILcdXMLMarshaller<? super T> getMarshaller(QName aXMLGlobalElementName, Class<T> aJavaClass)
TLcdXMLMarshallerProvider
getMarshaller
in class TLcdXMLMarshallerProvider
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.null
is returned.