Class JAXBUtils


  • public final class JAXBUtils
    extends Object
    • Method Detail

      • closeUnmarshaller

        public static void closeUnmarshaller​(javax.xml.bind.Unmarshaller u)
      • unmarshall

        public static Object unmarshall​(javax.xml.bind.JAXBContext c,
                                        Element e)
                                 throws javax.xml.bind.JAXBException
        Throws:
        javax.xml.bind.JAXBException
      • unmarshall

        public static <T> javax.xml.bind.JAXBElement<T> unmarshall​(javax.xml.bind.JAXBContext c,
                                                                   Element e,
                                                                   Class<T> cls)
                                                            throws javax.xml.bind.JAXBException
        Throws:
        javax.xml.bind.JAXBException
      • unmarshall

        public static Object unmarshall​(javax.xml.bind.JAXBContext c,
                                        Source s)
                                 throws javax.xml.bind.JAXBException
        Throws:
        javax.xml.bind.JAXBException
      • unmarshall

        public static <T> javax.xml.bind.JAXBElement<T> unmarshall​(javax.xml.bind.JAXBContext c,
                                                                   XMLStreamReader reader,
                                                                   Class<T> cls)
                                                            throws javax.xml.bind.JAXBException
        Throws:
        javax.xml.bind.JAXBException
      • unmarshall

        public static Object unmarshall​(javax.xml.bind.JAXBContext c,
                                        XMLStreamReader reader)
                                 throws javax.xml.bind.JAXBException
        Throws:
        javax.xml.bind.JAXBException
      • builtInTypeToJavaType

        public static String builtInTypeToJavaType​(String type)
      • holderClass

        public static Class<?> holderClass​(String type)
      • isJavaKeyword

        protected static boolean isJavaKeyword​(String word)
        Checks if the specified word is a Java keyword (as defined in JavaUtils).
        Parameters:
        word - the word to check.
        Returns:
        true if the word is a keyword.
        See Also:
        JavaUtils
      • namespaceURIToPackage

        public static String namespaceURIToPackage​(String namespaceURI)
        Generates a Java package name from a URI according to the algorithm outlined in JAXB 2.0.
        Parameters:
        namespaceURI - the namespace URI.
        Returns:
        the package name.
      • nameSpaceURIToPackage

        public static String nameSpaceURIToPackage​(URI uri)
        Generates a Java package name from a URI according to the algorithm outlined in Appendix D of JAXB (2.0+).
        Parameters:
        uri - the namespace URI.
        Returns:
        the package name.
      • nameToIdentifier

        public static String nameToIdentifier​(String name,
                                              JAXBUtils.IdentifierType type)
        Converts an XML name to a Java identifier according to the mapping algorithm outlined in the JAXB specification
        Parameters:
        name - the XML name
        Returns:
        the Java identifier
      • getValidClass

        public static Class<?> getValidClass​(Class<?> cls)
      • setNamespaceMapper

        public static Object setNamespaceMapper​(Bus bus,
                                                Map<String,​String> nspref,
                                                javax.xml.bind.Marshaller marshaller)
                                         throws javax.xml.bind.PropertyException
        Throws:
        javax.xml.bind.PropertyException
      • createSchemaCompiler

        public static JAXBUtils.SchemaCompiler createSchemaCompiler()
                                                             throws javax.xml.bind.JAXBException
        Throws:
        javax.xml.bind.JAXBException
      • createFileCodeWriter

        public static Object createFileCodeWriter​(File f)
                                           throws javax.xml.bind.JAXBException
        Throws:
        javax.xml.bind.JAXBException
      • createFileCodeWriter

        public static Object createFileCodeWriter​(File f,
                                                  String encoding)
                                           throws javax.xml.bind.JAXBException
        Throws:
        javax.xml.bind.JAXBException
      • getPackageNamespace

        public static String getPackageNamespace​(Class<?> cls)
      • isJAXB22

        public static boolean isJAXB22()
      • createJAXBContextProxy

        public static JAXBContextProxy createJAXBContextProxy​(javax.xml.bind.JAXBContext ctx)
      • setMinimumEscapeHandler

        public static void setMinimumEscapeHandler​(javax.xml.bind.Marshaller marshaller)
      • setNoEscapeHandler

        public static void setNoEscapeHandler​(javax.xml.bind.Marshaller marshaller)
      • setEscapeHandler

        public static void setEscapeHandler​(javax.xml.bind.Marshaller marshaller,
                                            Object escapeHandler)
      • createMininumEscapeHandler

        public static Object createMininumEscapeHandler​(Class<?> cls)
      • createNoEscapeHandler

        public static Object createNoEscapeHandler​(Class<?> cls)