|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tinyjee.maven.dim.utils.JaxbXmlSerializer<E>
public class JaxbXmlSerializer<E>
Implements a helper class that can serialize JAXB annotated classes between class tree and DOM document.
| Field Summary | |
|---|---|
String |
defaultSchemaBasename
|
String |
namespace
|
| Constructor Summary | |
|---|---|
JaxbXmlSerializer(Class<E> type)
Constructs a new XmlSerializer for the given type. |
|
JaxbXmlSerializer(Class<E> type,
String defaultSchemaBasename)
Constructs a new XmlSerializer for the given type. |
|
JaxbXmlSerializer(Class<E> type,
String namespace,
String defaultSchemaBasename)
Constructs a new XmlSerializer for the given type. |
|
JaxbXmlSerializer(String namespace,
String defaultSchemaBasename,
Class<? extends E>... types)
Constructs a new XmlSerializer for the given types. |
|
| Method Summary | |
|---|---|
E |
deserialize(Document document)
De-serializes the next type from the given document. |
Map<String,Document> |
generateSchema()
Generates the XSD schema and returns a map of all generated documents. |
Map<String,Document> |
generateSchema(String basename)
Generates the XSD schema and returns a map of all generated documents. |
javax.xml.bind.JAXBContext |
getJaxbContext()
|
Document |
serialize(E instance,
boolean includeSchema)
Serializes the given instance and returns a DOM document of the serialized content. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final String defaultSchemaBasename
public String namespace
| Constructor Detail |
|---|
public JaxbXmlSerializer(String namespace,
String defaultSchemaBasename,
Class<? extends E>... types)
namespace - the namespace to use.defaultSchemaBasename - the base filename to use when creating a XSD schema.types - the types to include in this serializer.public JaxbXmlSerializer(Class<E> type)
type - the type to serialize and de-serialize.
public JaxbXmlSerializer(Class<E> type,
String defaultSchemaBasename)
type - the type to serialize and de-serialize.defaultSchemaBasename - the base filename to use when creating a XSD schema.
public JaxbXmlSerializer(Class<E> type,
String namespace,
String defaultSchemaBasename)
type - the type to serialize and de-serialize.namespace - the namespace to use.defaultSchemaBasename - the base filename to use when creating a XSD schema.| Method Detail |
|---|
public javax.xml.bind.JAXBContext getJaxbContext()
public Map<String,Document> generateSchema()
throws Exception
Exception - in case of schema creation failed.
public Map<String,Document> generateSchema(String basename)
throws Exception
basename - the basename to use for naming the XSD files.
Exception - in case of schema creation failed.
public E deserialize(Document document)
throws Exception
document - the document to read from.
Exception - in case of reading or de-serializing fails.
public Document serialize(E instance,
boolean includeSchema)
throws Exception
instance - the instance to save.includeSchema - Whether the XSD schema shall be referenced and created inside the output directory.
Exception - in case of writing or serializing failed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||