public class JaxbExtensions extends Object
JAXBContext, Marshaller) inside the Groovy environment.
Static methods are used with the first parameter being the destination class.| Constructor and Description |
|---|
JaxbExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static <T> String |
marshal(JAXBContext self,
T jaxbElement)
Marshall an object to a xml
String. |
static <T> String |
marshal(Marshaller self,
T jaxbElement)
Marshall an object to a xml
String. |
static <T> T |
unmarshal(JAXBContext self,
String xml,
Class<T> declaredType)
Unmarshal xml data from the given
String to object of the given type. |
static <T> T |
unmarshal(Unmarshaller self,
String xml,
Class<T> declaredType)
Unmarshal xml data from the given
String to object of the given type. |
public static <T> String marshal(Marshaller self, T jaxbElement) throws JAXBException
String.self - a Marshaller which can marshall the type of the given objectjaxbElement - object to marshall to a StringString representing the object as xmlJAXBExceptionpublic static <T> String marshal(JAXBContext self, T jaxbElement) throws JAXBException
String.self - a JaxbContext, which recognizes the type of the given objectjaxbElement - object to marshall to a StringJAXBExceptionpublic static <T> T unmarshal(Unmarshaller self, String xml, Class<T> declaredType) throws JAXBException
String to object of the given type.self - Unmarshaller, a Unmarshaller which can unmarshall the type of the given objectxml - xml data as a StringdeclaredType - appropriate JAXB mapped class to hold node's xml dataJAXBExceptionpublic static <T> T unmarshal(JAXBContext self, String xml, Class<T> declaredType) throws JAXBException
String to object of the given type.self - a JaxbContext, which recognizes the type of the given objectxml - xml data as a StringdeclaredType - appropriate JAXB mapped class to hold node's xml dataJAXBException