public interface Converter<T>
Converter
object is used to convert an object
to XML by intercepting the normal serialization process. When
serializing an object the write
method is invoked.
This is provided with the object instance to be serialized and
the OutputNode
to use to write the XML. Values
can be taken from the instance and transferred to the node.
For deserialization the read
method is invoked.
This is provided with the InputNode
, which can be
used to read the elements and attributes representing the
member data of the object being deserialized. Once the object
has been instantiated it must be returned.
AnnotationStrategy
,
RegistryStrategy
Modifier and Type | Method and Description |
---|---|
T |
read(InputNode node)
This
read method is used to deserialize an object
from the source XML. |
void |
write(OutputNode node,
T value)
This
write method is used to serialize an object
to XML. |
T read(InputNode node) throws Exception
read
method is used to deserialize an object
from the source XML. The deserialization is performed using
the XML node provided. This node can be used to read the XML
elements and attributes in any format required. Once all of
the data has been extracted an instance must be returned.node
- this is the node to deserialize the object fromException
void write(OutputNode node, T value) throws Exception
write
method is used to serialize an object
to XML. The serialization should be performed in such a way
that all of the objects values are represented by an element
or attribute of the provided node. This ensures that it can
be fully deserialized at a later time.node
- this is the node to serialized to object tovalue
- this is the value that is to be serializedException