T - type of the roote elementpublic class JaxbFactory<T> extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
JaxbFactory()
Prevent instantiating with 0 arguments.
|
|
JaxbFactory(Class<? extends T> clazz)
creates a new jaxb factory.
|
|
JaxbFactory(Class<? extends T> clazz,
Class<?>... classes)
creates a new jaxb factory.
|
| Modifier and Type | Method and Description |
|---|---|
protected JAXBElement<T> |
createElement(T value)
creates a jax element for a given java object.
|
Class<? extends T> |
getClazz() |
JAXBContext |
getContext() |
T |
newInstance()
Create a new T instance.
|
T |
parse(Source source)
Parses a given source and creates a java object.
|
T |
parse(String value)
Parses a given string and creates a java object.
|
String |
serialize(T value)
Serializes a java object to the xml representation.
|
void |
serialize(T value,
Result result)
Serializes a java object to a xml sink.
|
void |
setClazz(Class<T> clazz) |
void |
setContext(JAXBContext context) |
protected JaxbFactory()
throws JAXBException
JAXBExceptionpublic JaxbFactory(Class<? extends T> clazz) throws JAXBException
clazz - JAXBExceptionpublic JaxbFactory(Class<? extends T> clazz, Class<?>... classes) throws JAXBException
clazz - class for the root elementclasses - other classesJAXBException - could happenpublic T newInstance()
public T parse(String value) throws JAXBException
value - serialized representationJAXBException - could happenpublic T parse(Source source) throws JAXBException
source - serialized representationJAXBException - could happenpublic String serialize(T value) throws JAXBException
value - java objectJAXBException - could happenpublic void serialize(T value, Result result) throws JAXBException
value - java objectresult - transform sinkJAXBException - could happenprotected JAXBElement<T> createElement(T value)
value - java objectpublic JAXBContext getContext()
public void setContext(JAXBContext context)
Copyright © 2018. All rights reserved.