|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jcoderz.commons.util.JaxbUtil
public final class JaxbUtil
Utility class to simplify JAXB marshalling/unmarshalling.
| Nested Class Summary | |
|---|---|
static class |
JaxbUtil.MarshalResult
Holds the Result of an Marshal operation. |
static class |
JaxbUtil.UnmarshalResult
Holds the Result of an unmarshal operation. |
static class |
JaxbUtil.ValidationEventCollector
Validation handler for JAXB. |
| Method Summary | |
|---|---|
static JAXBContext |
getJaxbContext(String contextPath)
Returns a JAXB context for the given context path. |
static JaxbUtil.MarshalResult |
marshal(Object data,
JAXBContext ctx)
Serializes (marshals) a given JAXB object and returns the result as byte array, along with the validation events collected during marshalling. |
static JaxbUtil.MarshalResult |
marshal(Object data,
String contextPath)
Serializes (marshals) a given JAXB object and returns the result as byte array, along with the validation events collected during marshalling. |
static JaxbUtil.UnmarshalResult |
unmarshal(InputSource data,
JAXBContext ctx)
Unmarshals the given InputSource and returns the unmarshalled object along with the validation event collector. |
static JaxbUtil.UnmarshalResult |
unmarshal(InputSource data,
String ctxPath)
Unmarshals the given InputSource and returns the unmarshalled object along with the validation event collector. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static JAXBContext getJaxbContext(String contextPath)
throws JAXBException
contextPath - the JAXB context path
JAXBException - if the context could not be retrieved
public static JaxbUtil.UnmarshalResult unmarshal(InputSource data,
String ctxPath)
throws JAXBException
data - the data to unmarshalctxPath - the context path from which the JAXBContext is created
to create an unmarshaller
JAXBException - if unmarshalling or validation fails.
public static JaxbUtil.UnmarshalResult unmarshal(InputSource data,
JAXBContext ctx)
throws JAXBException
data - the data to unmarshalctx - the JAXBContext from which the unmarshaller should be
retrieved
JAXBException - if unmarshalling or validation fails.
public static JaxbUtil.MarshalResult marshal(Object data,
String contextPath)
throws JAXBException
data - the object to marshalcontextPath - the context path to retrieve the corresponding JAXB
context for.
JAXBException - if marshalling or validation fails.
public static JaxbUtil.MarshalResult marshal(Object data,
JAXBContext ctx)
throws JAXBException
data - the object to marshalctx - the JAXBContext from which the unmarshaller can be retrieved.
JAXBException - if marshalling or validation fails.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||