Package org.simpleframework.xml.core
Interface Converter
-
- All Known Subinterfaces:
Repeater
- All Known Implementing Classes:
Composite
,CompositeArray
,CompositeInlineList
,CompositeInlineMap
,CompositeKey
,CompositeList
,CompositeListUnion
,CompositeMap
,CompositeMapUnion
,CompositeUnion
,CompositeValue
,Primitive
,PrimitiveArray
,PrimitiveInlineList
,PrimitiveKey
,PrimitiveList
,PrimitiveValue
,TextList
,Variable.Adapter
interface Converter
TheConverter
object serializes and deserializes XML elements. Serialization of lists, primitives, and compound types are performed using a converter. Any object read from a converter will produce a fully deserialized object will all its fields. The objects written to an XML element populate that element with attributes an elements according to the objects annotations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object
read(InputNode node)
Theread
method reads an object to a specific type from the provided node.java.lang.Object
read(InputNode node, java.lang.Object value)
Theread
method reads an object to a specific type from the provided node.boolean
validate(InputNode node)
Thevalidate
method is used to validate the class XML schema against an input source.void
write(OutputNode node, java.lang.Object object)
Thewrite
method writes the fields from the given object to the XML element.
-
-
-
Method Detail
-
read
java.lang.Object read(InputNode node) throws java.lang.Exception
Theread
method reads an object to a specific type from the provided node. If the node provided is an attribute then the object must be a primitive such as a string, integer, boolean, or any of the other Java primitive types.- Parameters:
node
- contains the details used to deserialize the object- Returns:
- a fully deserialized object will all its fields
- Throws:
java.lang.Exception
- if a deserialized type cannot be instantiated
-
read
java.lang.Object read(InputNode node, java.lang.Object value) throws java.lang.Exception
Theread
method reads an object to a specific type from the provided node. If the node provided is an attribute then the object must be a primitive such as a string, integer, boolean, or any of the other Java primitive types.- Parameters:
node
- contains the details used to deserialize the objectvalue
- this is an existing value to deserialize in to- Returns:
- a fully deserialized object will all its fields
- Throws:
java.lang.Exception
- if a deserialized type cannot be instantiated
-
validate
boolean validate(InputNode node) throws java.lang.Exception
Thevalidate
method is used to validate the class XML schema against an input source. This will traverse the class fields and methods ensuring that the input XML document contains a valid structure when compared against the class XML schema.- Parameters:
node
- contains the details used to validate the object- Returns:
- true if the document matches the class XML schema
- Throws:
java.lang.Exception
- if the class XML schema does not fully match
-
write
void write(OutputNode node, java.lang.Object object) throws java.lang.Exception
Thewrite
method writes the fields from the given object to the XML element. After this has finished the element contains all attributes and sub-elements from the object.- Parameters:
object
- this is the object to be written to the elementnode
- this is the element that is to be populated- Throws:
java.lang.Exception
- throw if the object cannot be serialized
-
-