Package org.simpleframework.xml.convert
Interface Converter<T>
public interface Converter<T>
The
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.
- See Also:
-
Method Summary
-
Method Details
-
read
Thisread
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.- Parameters:
node
- this is the node to deserialize the object from- Returns:
- the object instance resulting from the deserialization
- Throws:
Exception
-
write
Thiswrite
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.- Parameters:
node
- this is the node to serialized to object tovalue
- this is the value that is to be serialized- Throws:
Exception
-