Class JAXBUtil


  • public class JAXBUtil
    extends Object
    Utility to obtain JAXB2 marshaller/unmarshaller etc
    Since:
    May 26, 2009
    Author:
    Anil.Saldhana@redhat.com
    • Constructor Detail

      • JAXBUtil

        public JAXBUtil()
    • Method Detail

      • getValidatingMarshaller

        public static javax.xml.bind.Marshaller getValidatingMarshaller​(String pkgName,
                                                                        String schemaLocation)
                                                                 throws javax.xml.bind.JAXBException,
                                                                        SAXException
        Get the JAXB Marshaller
        Parameters:
        pkgName - The package name for the jaxb context
        schemaLocation - location of the schema to validate against
        Returns:
        Marshaller
        Throws:
        javax.xml.bind.JAXBException
        SAXException
      • getMarshaller

        public static javax.xml.bind.Marshaller getMarshaller​(String pkgName)
                                                       throws javax.xml.bind.JAXBException
        Get the JAXB Marshaller
        Parameters:
        pkgName - The package name for the jaxb context
        Returns:
        Marshaller
        Throws:
        javax.xml.bind.JAXBException
      • getUnmarshaller

        public static javax.xml.bind.Unmarshaller getUnmarshaller​(String pkgName)
                                                           throws javax.xml.bind.JAXBException
        Get the JAXB Unmarshaller
        Parameters:
        pkgName - The package name for the jaxb context
        Returns:
        unmarshaller
        Throws:
        javax.xml.bind.JAXBException
      • getUnmarshaller

        public static javax.xml.bind.Unmarshaller getUnmarshaller​(String... pkgNames)
                                                           throws javax.xml.bind.JAXBException
        Get the JAXB Unmarshaller for a selected set of package names
        Parameters:
        pkgNames -
        Returns:
        Throws:
        javax.xml.bind.JAXBException
      • getValidatingUnmarshaller

        public static javax.xml.bind.Unmarshaller getValidatingUnmarshaller​(String pkgName,
                                                                            String schemaLocation)
                                                                     throws javax.xml.bind.JAXBException,
                                                                            SAXException
        Get the JAXB Unmarshaller
        Parameters:
        pkgName - The package name for the jaxb context
        schemaLocation - location of the schema to validate against
        Returns:
        unmarshaller
        Throws:
        javax.xml.bind.JAXBException
        SAXException
      • getJAXBContext

        public static javax.xml.bind.JAXBContext getJAXBContext​(String path)
                                                         throws javax.xml.bind.JAXBException
        Throws:
        javax.xml.bind.JAXBException
      • getJAXBContext

        public static javax.xml.bind.JAXBContext getJAXBContext​(String... paths)
                                                         throws javax.xml.bind.JAXBException
        Throws:
        javax.xml.bind.JAXBException
      • getJAXBContext

        public static javax.xml.bind.JAXBContext getJAXBContext​(Class<?> clazz)
                                                         throws javax.xml.bind.JAXBException
        Throws:
        javax.xml.bind.JAXBException