T
- public class JaxbObject<T> extends Object
Constructor and Description |
---|
JaxbObject()
JAXB has a memory leak when it comes to making new JAXBContext instances, so one JAXBContext is created for the entire lifetime of
the program and initialized with all of the classes that we marshal and unmarshal at the moment, as per the instructions at *
http://whileonefork.blogspot.com/2010/09/leaking-of-jaxb.html and * http://jaxb.java.net/guide/Performance_and_thread_safety.html .
|
Modifier and Type | Method and Description |
---|---|
String |
marshal(T t)
Turn an object into XML using JAXB and provide the result in a StreamResult.
|
Document |
marshalToDocument(T t)
Turn an object into XML using JAXB and provide the result in a StreamResult.
|
T |
unMarshal(Document d,
T expectedType)
Turn an XML stream into an object, if possible.
|
T |
unMarshal(T expectedType,
Reader reader)
Turn an XML stream into an object, if possible.
|
public JaxbObject()
public Document marshalToDocument(T t) throws JAXBException
t
- The object to XMLize.JAXBException
- if any.public String marshal(T t) throws JAXBException
t
- The object to XMLize.JAXBException
- if any.public T unMarshal(T expectedType, Reader reader) throws JAXBException
expectedType
- a T object.reader
- a Reader
object.JAXBException
- if any.public T unMarshal(Document d, T expectedType) throws JAXBException
expectedType
- a T object.d
- a Document
object.JAXBException
- if any.Copyright © 2015 SeqWare. All rights reserved.