Class TLcdXMLSchemaBasedMarshallerProvider
java.lang.Object
com.luciad.format.xml.bind.TLcdXMLMarshallerProvider
com.luciad.format.xml.bind.schema.TLcdXMLSchemaBasedMarshallerProvider
Extended
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 Summary
ConstructorsConstructorDescriptionCreates a new marshaller provider for the given encoder. -
Method Summary
Modifier and TypeMethodDescription<T> ILcdXMLMarshaller<? super T> getMarshaller(TLcdXMLSchemaElementIdentifier aElementId, Class<T> aJavaClass) Gets a marshaller for the given element and class.<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> voidregisterMarshaller(TLcdXMLSchemaElementIdentifier aElementId, Class<T> aJavaClass, ILcdXMLMarshaller<? super T> aMarshaller) Registers a marshaller for the given element and java class.<T> voidregisterMarshaller(QName aXMLElementName, Class<T> aJavaClass, ILcdXMLMarshaller<? super T> aMarshaller) Registers anILcdXMLMarshallerwhich is capable of marshalling the specified Java class to the specified XML element.Methods inherited from class com.luciad.format.xml.bind.TLcdXMLMarshallerProvider
getMarshaller, toString
-
Constructor Details
-
TLcdXMLSchemaBasedMarshallerProvider
Creates a new marshaller provider for the given encoder.- Parameters:
aEncoder- the encoder whose type marshaller provider will be used.
-
-
Method Details
-
registerMarshaller
public <T> void registerMarshaller(QName aXMLElementName, Class<T> aJavaClass, ILcdXMLMarshaller<? super T> aMarshaller) Description copied from class:TLcdXMLMarshallerProviderRegisters anILcdXMLMarshallerwhich 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).- Overrides:
registerMarshallerin classTLcdXMLMarshallerProvider- 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.
-
getMarshaller
public <T> ILcdXMLMarshaller<? super T> getMarshaller(TLcdXMLSchemaElementIdentifier aElementId, Class<T> aJavaClass) Gets a marshaller for the given element and class. This method is typically used for elements for which no substitution is possible. If no marshaller was registered for the given element and class, returns an adapter around the corresponding type marshaller.- Parameters:
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 marshaller- Returns:
- a marshaller for the given element identifier and class
-
registerMarshaller
public <T> void registerMarshaller(TLcdXMLSchemaElementIdentifier aElementId, Class<T> aJavaClass, ILcdXMLMarshaller<? super T> aMarshaller) Registers a marshaller for the given element and java class.- Parameters:
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 class
-
getMarshaller
public <T> ILcdXMLMarshaller<? super T> getMarshaller(QName aXMLGlobalElementName, Class<T> aJavaClass) Description copied from class:TLcdXMLMarshallerProviderReturns a marshaller which is capable of marshalling instances of the specified Java class into instances of the specified XML element.- Overrides:
getMarshallerin classTLcdXMLMarshallerProvider- Parameters:
aXMLGlobalElementName- the XML element to which the marshaller should marshal the Java instances, ornullif 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,
nullis returned.
-