Package jakarta.el

Class FactoryFinder


  • class FactoryFinder
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      FactoryFinder()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static java.lang.Object find​(java.lang.Class<?> serviceClass, java.lang.String factoryId, java.lang.String fallbackClassName, java.util.Properties properties)
      Finds the implementation Class object for the given factory.
      private static java.lang.Object newInstance​(java.lang.String className, java.lang.ClassLoader classLoader, java.util.Properties properties)
      Creates an instance of the specified class using the specified ClassLoader object.
      • Methods inherited from class java.lang.Object

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

      • FactoryFinder

        FactoryFinder()
    • Method Detail

      • newInstance

        private static java.lang.Object newInstance​(java.lang.String className,
                                                    java.lang.ClassLoader classLoader,
                                                    java.util.Properties properties)
        Creates an instance of the specified class using the specified ClassLoader object.
        Throws:
        ELException - if the given class could not be found or could not be instantiated
      • find

        static java.lang.Object find​(java.lang.Class<?> serviceClass,
                                     java.lang.String factoryId,
                                     java.lang.String fallbackClassName,
                                     java.util.Properties properties)
        Finds the implementation Class object for the given factory. The following search order is used:
        1. ServiceLoader lookup using serviceClass
        2. Property file located as $java.home/lib/el.properties
        3. System property lookup using factoryId
        4. Create an instance of fallbackClassName
        This method is package private so that this code can be shared.
        Parameters:
        serviceClass - The class to use when searching for the factory using the ServiceLoader mechanism
        factoryId - the name of the factory to find, which is a system property
        fallbackClassName - the implementation class name, which is to be used only if nothing else is found; null to indicate that there is no fallback class name
        Returns:
        the Class object of the specified message factory; may not be null
        Throws:
        ELException - if there is an error