T - the type that is read/written by this XMLFormat.public class ReflectionFormat<T>
extends javolution.xml.XMLFormat<T>
XMLFormat that provides the binding for a certain class to to/from
xml based on reflection.
When serializing an object to xml, the values of the declared fields are read
(including inherited fields) from the object. Fields marked as
transient or static are omitted.
During deserialization, first all attributes contained in the xml are read and written to the object. Afterwards the fields that are bound to elements are checked for contained xml elements and in this case the values are written to the object.
APPENDABLE_XML, BOOLEAN_XML, BYTE_XML, CHARACTER_XML, CLASS_XML, COLLECTION_XML, CONFIGURABLE_XML, DOUBLE_XML, FAST_COLLECTION_XML, FAST_COMPARATOR_XML, FAST_MAP_XML, FLOAT_XML, INDEX_XML, INTEGER_XML, LONG_XML, MAP_XML, OBJECT_ARRAY_XML, OBJECT_XML, PERSISTENT_CONTEXT_XML, QNAME_XML, SHORT_XML, STRING_XML, TEXT_XML| Constructor and Description |
|---|
ReflectionFormat(Class<T> clazz,
ClassLoader classLoader)
Creates a new instance for the provided class.
|
| Modifier and Type | Method and Description |
|---|---|
protected static boolean |
isAttribute(Class<?> clazz) |
protected static boolean |
isAttribute(Field field) |
T |
newInstance(Class<T> clazz,
javolution.xml.XMLFormat.InputElement xml) |
void |
read(javolution.xml.XMLFormat.InputElement input,
T obj) |
void |
write(T obj,
javolution.xml.XMLFormat.OutputElement output) |
public ReflectionFormat(Class<T> clazz, ClassLoader classLoader)
clazz - the Class that is supported by this XMLFormat.classLoader - the ClassLoader that is used to load user types.protected static boolean isAttribute(Field field)
protected static boolean isAttribute(Class<?> clazz)
public T newInstance(Class<T> clazz, javolution.xml.XMLFormat.InputElement xml) throws javolution.xml.stream.XMLStreamException
newInstance in class javolution.xml.XMLFormat<T>javolution.xml.stream.XMLStreamExceptionpublic void read(javolution.xml.XMLFormat.InputElement input,
T obj)
throws javolution.xml.stream.XMLStreamException
read in class javolution.xml.XMLFormat<T>javolution.xml.stream.XMLStreamExceptionCopyright © 2009-2016. All Rights Reserved.