public class JaxbExtensions
extends java.lang.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> java.lang.String |
marshal(javax.xml.bind.JAXBContext self,
T jaxbElement)
Marshall an object to a xml
String . |
static <T> java.lang.String |
marshal(javax.xml.bind.Marshaller self,
T jaxbElement)
Marshall an object to a xml
String . |
static <T> T |
unmarshal(javax.xml.bind.JAXBContext self,
java.lang.String xml,
java.lang.Class<T> declaredType)
Unmarshal xml data from the given
String to object of the given type. |
static <T> T |
unmarshal(javax.xml.bind.Unmarshaller self,
java.lang.String xml,
java.lang.Class<T> declaredType)
Unmarshal xml data from the given
String to object of the given type. |
public static <T> java.lang.String marshal(javax.xml.bind.Marshaller self, T jaxbElement) throws javax.xml.bind.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 xmljavax.xml.bind.JAXBException
public static <T> java.lang.String marshal(javax.xml.bind.JAXBContext self, T jaxbElement) throws javax.xml.bind.JAXBException
String
.self
- a JaxbContext, which recognizes the type of the given objectjaxbElement
- object to marshall to a String
javax.xml.bind.JAXBException
public static <T> T unmarshal(javax.xml.bind.Unmarshaller self, java.lang.String xml, java.lang.Class<T> declaredType) throws javax.xml.bind.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 datajavax.xml.bind.JAXBException
public static <T> T unmarshal(javax.xml.bind.JAXBContext self, java.lang.String xml, java.lang.Class<T> declaredType) throws javax.xml.bind.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 datajavax.xml.bind.JAXBException