Package org.simpleframework.xml.convert
Interface Converter<T>
-
public interface Converter<T>
TheConverter
object is used to convert an object to XML by intercepting the normal serialization process. When serializing an object thewrite
method is invoked. This is provided with the object instance to be serialized and theOutputNode
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 theInputNode
, 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:
AnnotationStrategy
,RegistryStrategy
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
read(InputNode node)
Thisread
method is used to deserialize an object from the source XML.void
write(OutputNode node, T value)
Thiswrite
method is used to serialize an object to XML.
-
-
-
Method Detail
-
read
T read(InputNode node) throws java.lang.Exception
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:
java.lang.Exception
-
write
void write(OutputNode node, T value) throws java.lang.Exception
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:
java.lang.Exception
-
-