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 String
String
representing the object as xmlJAXBException
public 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 String
JAXBException
public 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 String
declaredType
- appropriate JAXB mapped class to hold node's xml dataJAXBException
public 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 String
declaredType
- appropriate JAXB mapped class to hold node's xml dataJAXBException