public class XmlSerializer
extends java.lang.Object
Field
annotationsConstructor and Description |
---|
XmlSerializer() |
Modifier and Type | Method and Description |
---|---|
<T> T |
fromXml(java.io.Reader reader,
java.lang.Class<T> clazz)
Reads an XML document from a
Reader and converts it into an object of the specified type |
<T> T |
fromXml(java.lang.String xml,
java.lang.Class<T> clazz)
Reads a XML document and converts it into an object of the specified type
|
<T> java.lang.String |
toXml(T object)
Writes a XML document by searching the object for
Field annotations |
<T> void |
toXml(T object,
java.io.Writer writer)
Writes a XML document to a
Writer by searching the object for Field annotations |
public <T> T fromXml(java.lang.String xml, java.lang.Class<T> clazz) throws SerializationException
T
- The type of Class
to returnxml
- The XML documentclazz
- The Class
to convert the document toSerializationException
- Thrown when the data is invalidpublic <T> T fromXml(java.io.Reader reader, java.lang.Class<T> clazz) throws SerializationException
Reader
and converts it into an object of the specified typeT
- The type of Class
to returnreader
- The input stream reading the XML documentclazz
- The Class
to convert the document toSerializationException
- Thrown when the data is invalidpublic <T> java.lang.String toXml(T object) throws SerializationException
Field
annotationsT
- The type of Class
to writeobject
- The object to convert to XMLSerializationException
- Thrown when the object is invalidpublic <T> void toXml(T object, java.io.Writer writer) throws SerializationException
Writer
by searching the object for Field
annotationsT
- The type of Class
to writeobject
- The object to convert to XMLwriter
- The stream to write the XML document toSerializationException
- Thrown when the object is invalid