org.opennms.core.xml
Class JaxbUtils

java.lang.Object
  extended by org.opennms.core.xml.JaxbUtils

public class JaxbUtils
extends Object


Method Summary
static Marshaller getMarshallerFor(Object obj, JAXBContext jaxbContext)
           
static Unmarshaller getUnmarshallerFor(Object obj, JAXBContext jaxbContext, boolean validate)
          Get a JAXB unmarshaller for the given object.
static
<T> XMLFilter
getXMLFilterForClass(Class<T> clazz)
           
static String marshal(Object obj)
           
static void marshal(Object obj, Writer writer)
           
static
<T> T
unmarshal(Class<T> clazz, File file)
           
static
<T> T
unmarshal(Class<T> clazz, File file, boolean validate)
           
static
<T> T
unmarshal(Class<T> clazz, InputSource inputSource)
           
static
<T> T
unmarshal(Class<T> clazz, InputSource inputSource, boolean validate)
           
static
<T> T
unmarshal(Class<T> clazz, InputSource inputSource, JAXBContext jaxbContext)
           
static
<T> T
unmarshal(Class<T> clazz, InputSource inputSource, JAXBContext jaxbContext, boolean validate)
           
static
<T> T
unmarshal(Class<T> clazz, Reader reader)
           
static
<T> T
unmarshal(Class<T> clazz, Reader reader, boolean validate)
           
static
<T> T
unmarshal(Class<T> clazz, org.springframework.core.io.Resource resource)
           
static
<T> T
unmarshal(Class<T> clazz, org.springframework.core.io.Resource resource, boolean validate)
           
static
<T> T
unmarshal(Class<T> clazz, String xml)
           
static
<T> T
unmarshal(Class<T> clazz, String xml, boolean validate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

marshal

public static String marshal(Object obj)

marshal

public static void marshal(Object obj,
                           Writer writer)

unmarshal

public static <T> T unmarshal(Class<T> clazz,
                              File file)

unmarshal

public static <T> T unmarshal(Class<T> clazz,
                              File file,
                              boolean validate)

unmarshal

public static <T> T unmarshal(Class<T> clazz,
                              Reader reader)

unmarshal

public static <T> T unmarshal(Class<T> clazz,
                              Reader reader,
                              boolean validate)

unmarshal

public static <T> T unmarshal(Class<T> clazz,
                              String xml)

unmarshal

public static <T> T unmarshal(Class<T> clazz,
                              String xml,
                              boolean validate)

unmarshal

public static <T> T unmarshal(Class<T> clazz,
                              org.springframework.core.io.Resource resource)

unmarshal

public static <T> T unmarshal(Class<T> clazz,
                              org.springframework.core.io.Resource resource,
                              boolean validate)

unmarshal

public static <T> T unmarshal(Class<T> clazz,
                              InputSource inputSource)

unmarshal

public static <T> T unmarshal(Class<T> clazz,
                              InputSource inputSource,
                              boolean validate)

unmarshal

public static <T> T unmarshal(Class<T> clazz,
                              InputSource inputSource,
                              JAXBContext jaxbContext)

unmarshal

public static <T> T unmarshal(Class<T> clazz,
                              InputSource inputSource,
                              JAXBContext jaxbContext,
                              boolean validate)

getXMLFilterForClass

public static <T> XMLFilter getXMLFilterForClass(Class<T> clazz)
                                      throws SAXException
Throws:
SAXException

getMarshallerFor

public static Marshaller getMarshallerFor(Object obj,
                                          JAXBContext jaxbContext)

getUnmarshallerFor

public static Unmarshaller getUnmarshallerFor(Object obj,
                                              JAXBContext jaxbContext,
                                              boolean validate)
Get a JAXB unmarshaller for the given object. If no JAXBContext is provided, JAXBUtils will create and cache a context for the given object.

Parameters:
obj - The object type to be unmarshaled.
jaxbContext - An optional JAXB context to create the unmarshaller from.
validate - TODO
Returns:
an Unmarshaller


Copyright © 2011. All Rights Reserved.