Class ModuleUtil


  • class ModuleUtil
    extends java.lang.Object
    Intended to be overridden on JDK9, with JEP 238 multi-release class copy. Contains only stubs for methods needed on JDK9 runtime.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static java.lang.String DEFAULT_FACTORY_CLASS
      When JAXB is in J2SE, rt.jar has to have a JAXB implementation.
    • Constructor Summary

      Constructors 
      Constructor Description
      ModuleUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static void delegateAddOpensToImplModule​(java.lang.Class[] classes, java.lang.Class<?> factorySPI)
      Implementation may be defined in other module than java.xml.bind.
      (package private) static java.lang.Class findFirstByJaxbIndex​(java.lang.String pkg, java.lang.ClassLoader classLoader)
      Find first class in package by jaxb.index file.
      (package private) static java.lang.Class[] getClassesFromContextPath​(java.lang.String contextPath, java.lang.ClassLoader classLoader)
      Resolves classes from context path.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_FACTORY_CLASS

        static final java.lang.String DEFAULT_FACTORY_CLASS
        When JAXB is in J2SE, rt.jar has to have a JAXB implementation. However, rt.jar cannot have META-INF/services/javax.xml.bind.JAXBContext because if it has, it will take precedence over any file that applications have in their jar files.

        When the user bundles his own JAXB implementation, we'd like to use it, and we want the platform default to be used only when there's no other JAXB provider.

        For this reason, we have to hard-code the class name into the API.

    • Constructor Detail

      • ModuleUtil

        ModuleUtil()
    • Method Detail

      • getClassesFromContextPath

        static java.lang.Class[] getClassesFromContextPath​(java.lang.String contextPath,
                                                           java.lang.ClassLoader classLoader)
                                                    throws JAXBException
        Resolves classes from context path. Only one class per package is needed to access its Module
        Throws:
        JAXBException
      • findFirstByJaxbIndex

        static java.lang.Class findFirstByJaxbIndex​(java.lang.String pkg,
                                                    java.lang.ClassLoader classLoader)
                                             throws java.io.IOException,
                                                    JAXBException
        Find first class in package by jaxb.index file.
        Throws:
        java.io.IOException
        JAXBException
      • delegateAddOpensToImplModule

        static void delegateAddOpensToImplModule​(java.lang.Class[] classes,
                                                 java.lang.Class<?> factorySPI)
        Implementation may be defined in other module than java.xml.bind. In that case openness open of classes should be delegated to implementation module.
        Parameters:
        classes - used to resolve module for Module.addOpens(String, java.lang.Module)
        factorySPI - used to resolve Module of the implementation.