public class JaxbExtensions
This class defines new groovy methods which appear on Jaxb-related JDK
classes (JAXBContext
, Marshaller
) inside the Groovy environment.
Static methods are used with the first parameter being the destination class.
Type Params | Return Type | Name and description |
---|---|---|
<T> |
public static String |
marshal(Marshaller self, T jaxbElement) Marshall an object to a xml String . |
<T> |
public static String |
marshal(JAXBContext self, T jaxbElement) Marshall an object to a xml String . |
<T> |
public static T |
unmarshal(Unmarshaller self, String xml, Class<T> declaredType) Unmarshal xml data from the given String to object of the given type. |
<T> |
public static T |
unmarshal(JAXBContext self, String xml, Class<T> declaredType) Unmarshal xml data from the given String to object of the given type. |
Marshall an object to a xml String
.
self
- a Marshaller which can marshall the type of the given objectjaxbElement
- object to marshall to a String
String
representing the object as xml Marshall an object to a xml String
.
self
- a JaxbContext, which recognizes the type of the given objectjaxbElement
- object to marshall to a String
Unmarshal xml data from the given 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 data Unmarshal xml data from the given 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 data