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 <T> T find​(java.lang.Class<T> factoryClass)
      Finds the implementation Class object for the given factory type.
      (package private) static <T> T find​(java.lang.Class<T> factoryClass, java.lang.ClassLoader loader)  
      private static java.lang.String fromSystemProperty​(java.lang.String factoryId)  
      private static java.lang.ClassLoader[] getClassLoaders​(java.lang.Class<?>... classes)  
      private static java.lang.Class<?>[] getHk2ServiceLoaderTargets​(java.lang.Class<?> factoryClass)  
      private static java.lang.String getSystemProperty​(java.lang.String property)  
      private static void logFound​(java.lang.String value)  
      private static <T> T lookupUsingHk2ServiceLoader​(java.lang.Class<T> factoryClass, java.lang.ClassLoader loader)  
      private static <T> T newInstance​(java.lang.String className, java.lang.Class<? extends T> service, java.lang.ClassLoader loader)  
      • Methods inherited from class java.lang.Object

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

      • logger

        private static final java.util.logging.Logger logger
    • Constructor Detail

      • FactoryFinder

        FactoryFinder()
    • Method Detail

      • find

        static <T> T find​(java.lang.Class<T> factoryClass)
                   throws java.lang.RuntimeException
        Finds the implementation Class object for the given factory type.

        This method is package private so that this code can be shared.

        Parameters:
        factoryClass - factory abstract class or interface to be found
        Returns:
        the Class object of the specified message factory; may not be null
        Throws:
        java.lang.IllegalStateException - if there is no factory found
        java.lang.RuntimeException
      • find

        static <T> T find​(java.lang.Class<T> factoryClass,
                          java.lang.ClassLoader loader)
                   throws java.lang.RuntimeException
        Throws:
        java.lang.RuntimeException
      • newInstance

        private static <T> T newInstance​(java.lang.String className,
                                         java.lang.Class<? extends T> service,
                                         java.lang.ClassLoader loader)
                                  throws java.lang.RuntimeException
        Throws:
        java.lang.RuntimeException
      • fromSystemProperty

        private static java.lang.String fromSystemProperty​(java.lang.String factoryId)
      • getSystemProperty

        private static java.lang.String getSystemProperty​(java.lang.String property)
      • logFound

        private static void logFound​(java.lang.String value)
      • getHk2ServiceLoaderTargets

        private static java.lang.Class<?>[] getHk2ServiceLoaderTargets​(java.lang.Class<?> factoryClass)
      • lookupUsingHk2ServiceLoader

        private static <T> T lookupUsingHk2ServiceLoader​(java.lang.Class<T> factoryClass,
                                                         java.lang.ClassLoader loader)
      • getClassLoaders

        private static java.lang.ClassLoader[] getClassLoaders​(java.lang.Class<?>... classes)