T
- The Java class handled by the ILcdXMLTypeMarshaller
to be wrapped.public class TLcdXMLMarshallerAdapter<T> extends Object implements ILcdXMLMarshaller<T>
ILcdXMLTypeMarshaller
that converts it into an
ILcdXMLMarshaller
. The marshal()
method of this adapter will first write the
element's start tag, then delegate further marshalling to the wrapped type marshaller and finally
write the element's end tag.Constructor and Description |
---|
TLcdXMLMarshallerAdapter(QName aElementName,
ILcdXMLTypeMarshaller<? super T> aTypeMarshaller)
Creates a new
TLcdXMLMarshallerAdapter wrapping the specified type marshaller. |
Modifier and Type | Method and Description |
---|---|
QName |
getElementName()
Returns the element name this adapter will write.
|
void |
marshal(T aObject,
XMLStreamWriter aWriter,
ILcdXMLDocumentContext aContext)
Marshals (serializes) the specified Java object or content tree to an XML element via the specified
XMLStreamWriter . |
String |
toString() |
public TLcdXMLMarshallerAdapter(QName aElementName, ILcdXMLTypeMarshaller<? super T> aTypeMarshaller)
TLcdXMLMarshallerAdapter
wrapping the specified type marshaller.aElementName
- the XML element name to be written by this marshaller adapter.aTypeMarshaller
- the type marshaller to be wrapped.public void marshal(T aObject, XMLStreamWriter aWriter, ILcdXMLDocumentContext aContext) throws XMLStreamException
ILcdXMLMarshaller
XMLStreamWriter
.
This method should write a start tag for the object to be marshalled, followed by all the contents (attributes,
simple content and child elements) of the object, and end with the corresponding end tag for the object.marshal
in interface ILcdXMLMarshaller<T>
aObject
- the object to be marshalled.aWriter
- the XMLStreamWriter to marshal the object to.aContext
- a ILcdXMLDocumentContext
which can be used to store and retrieve information which is shared
between multiple marshallers. This context is unique per marshalled XML document.XMLStreamException
- if any unexpected content occurs while marshalling the object.public QName getElementName()