Class JaxbExtensions
java.lang.Object
org.apache.groovy.jaxb.extensions.JaxbExtensions
public class JaxbExtensions
extends java.lang.Object
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.- 
Constructor SummaryConstructors Constructor Description JaxbExtensions()
- 
Method SummaryModifier and Type Method Description static <T> java.lang.Stringmarshal(JAXBContext self, T jaxbElement)Marshall an object to a xmlString.static <T> java.lang.Stringmarshal(Marshaller self, T jaxbElement)Marshall an object to a xmlString.static <T> Tunmarshal(JAXBContext self, java.lang.String xml, java.lang.Class<T> declaredType)Unmarshal xml data from the givenStringto object of the given type.static <T> Tunmarshal(Unmarshaller self, java.lang.String xml, java.lang.Class<T> declaredType)Unmarshal xml data from the givenStringto object of the given type.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- 
Constructor Details- 
JaxbExtensionspublic JaxbExtensions()
 
- 
- 
Method Details- 
marshalMarshall an object to a xmlString.- Parameters:
- self- a Marshaller which can marshall the type of the given object
- jaxbElement- object to marshall to a- String
- Returns:
- Stringrepresenting the object as xml
- Throws:
- JAXBException
 
- 
marshalMarshall an object to a xmlString.- Parameters:
- self- a JaxbContext, which recognizes the type of the given object
- jaxbElement- object to marshall to a- String
- Returns:
- String representing the object as xml
- Throws:
- JAXBException
 
- 
unmarshalpublic static <T> T unmarshal(Unmarshaller self, java.lang.String xml, java.lang.Class<T> declaredType) throws JAXBExceptionUnmarshal xml data from the givenStringto object of the given type.- Parameters:
- self- Unmarshaller, a Unmarshaller which can unmarshall the type of the given object
- xml- xml data as a- String
- declaredType- appropriate JAXB mapped class to hold node's xml data
- Returns:
- instance of destination class unmarshalled from xml
- Throws:
- JAXBException
 
- 
unmarshalpublic static <T> T unmarshal(JAXBContext self, java.lang.String xml, java.lang.Class<T> declaredType) throws JAXBExceptionUnmarshal xml data from the givenStringto object of the given type.- Parameters:
- self- a JaxbContext, which recognizes the type of the given object
- xml- xml data as a- String
- declaredType- appropriate JAXB mapped class to hold node's xml data
- Returns:
- instance of destination class unmarshalled from xml
- Throws:
- JAXBException
 
 
-