Package org.duracloud.common.xml
Class XmlSerializer<T>
java.lang.Object
org.duracloud.common.xml.XmlSerializer<T>
Handles the transfer of java beans to XML and back through JAXB
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedXmlSerializer(Class clazz, String schemaName, String schemaVersion) Creates a serializer which will be used to handle serializations to and from the given top level class, using the given schema. -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(InputStream stream) De-serializes XML from an InputStream into an object structure.deserialize(String xml) De-serializes XML into an object structure.Serializes the data stored within a java bean to XML.
-
Constructor Details
-
XmlSerializer
Creates a serializer which will be used to handle serializations to and from the given top level class, using the given schema.- Parameters:
clazz- class which should be annotated as an XmlRootElementschemaName- name of the schema to use for validationschemaVersion- version of the schema expected
-
-
Method Details
-
serialize
Serializes the data stored within a java bean to XML. The bean and any ancillary beans should include JAXB binding annotations.- Parameters:
obj- to serialize- Returns:
- XML
-
deserialize
De-serializes XML into an object structure.- Parameters:
xml- to de-serialize- Returns:
- de-serialized object
-
deserialize
De-serializes XML from an InputStream into an object structure.- Parameters:
stream- containing XML to de-serialize- Returns:
- de-serialized object
-