public final class JaxbUtils extends Object
| Constructor and Description |
|---|
JaxbUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
marshal(JAXBElement value,
Writer output)
Marshals a JAXBElement object into XML data to write to a character stream.
|
static Document |
marshalToDom(JAXBElement value)
Marshals a JAXBElement object into a DOM document.
|
static String |
marshalToString(JAXBElement value)
Marshals a JAXBElement object into a XML data string.
|
static <T> T |
unmarshal(Node xmlNode,
Class<T> jaxbClass)
Unmarshals the XML data in a DOM node into a Java object using JAXB.
|
static <T> T |
unmarshal(Reader reader,
Class<T> jaxbClass)
Unmarshals the XML data from a character stream into a Java object using
JAXB.
|
public static <T> T unmarshal(Node xmlNode, Class<T> jaxbClass) throws JAXBException
javax.xml.bind.Unmarshaller#unmarshal(Source).T - xmlNode - DOM node to read the XML data from. Cannot be null.jaxbClass - JAXB-generated class that represents the XML data as a Java class.
Cannot be null.JAXBException - If there is a problem with unmarshalling.public static <T> T unmarshal(Reader reader, Class<T> jaxbClass) throws JAXBException
javax.xml.bind.Unmarshaller#unmarshal(Source).T - reader - Character stream to read the XML data from. Cannot be null.jaxbClass - JAXB-generated class that represents the XML data as a Java class.
Cannot be null.JAXBException - If there is a problem with unmarshalling.public static void marshal(JAXBElement value, Writer output) throws JAXBException, IOException
javax.xml.bind.Marshaller#marshal(Object, Writer). A JAXBElement can be
created from the ObjectFactory generated by JAXB for each package.value - JAXBElement to marshal into XML data. Cannot be null.output - Character stream to write to. Cannot be null.JAXBException - If there is a problem with marshalling.IOException - If there is a problem with writing.public static String marshalToString(JAXBElement value) throws JAXBException
javax.xml.bind.Marshaller#marshal(Object, Writer). A JAXBElement can be
created from the ObjectFactory generated by JAXB for each package.value - JAXBElement to marshal into XML data. Cannot be null.JAXBException - If there is a problem with marshalling.public static Document marshalToDom(JAXBElement value) throws JAXBException, ParserConfigurationException
javax.xml.bind.Marshaller#marshal(Object, Node). A JAXBElement can be
created from the ObjectFactory generated by JAXB for each package.value - JAXBElement to marshal into XML data. Cannot be null.JAXBException - If there is a problem with marshalling.ParserConfigurationException - If there is a config problem.Copyright © 2021. All rights reserved.