Class FactoryFinder

java.lang.Object
jakarta.ws.rs.ext.FactoryFinder

final class FactoryFinder extends Object
Factory finder utility class.
Since:
1.0
  • Field Details

    • LOGGER

      private static final Logger LOGGER
  • Constructor Details

    • FactoryFinder

      private FactoryFinder()
  • Method Details

    • getContextClassLoader

      private static ClassLoader getContextClassLoader()
    • newInstance

      private static Object newInstance(String className, ClassLoader classLoader) throws ClassNotFoundException
      Creates an instance of the specified class using the specified ClassLoader object.
      Parameters:
      className - name of the class to be instantiated.
      classLoader - class loader to be used.
      Returns:
      instance of the specified class.
      Throws:
      ClassNotFoundException - if the given class could not be found or could not be instantiated.
    • find

      static <T> Object find(String factoryId, Class<T> service) throws ClassNotFoundException
      Finds the implementation Class for the given factory name and create its instance.

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

      Type Parameters:
      T - type of the service to be found.
      Parameters:
      factoryId - the name of the factory to find, which is a system property.
      service - service to be found.
      Returns:
      the instance of the specified service; may not be null.
      Throws:
      ClassNotFoundException - if the given class could not be found or could not be instantiated.
    • getClassLoader

      private static ClassLoader getClassLoader()
    • findFirstService

      private static <T> T findFirstService(String factoryId, ClassLoader cl, Class<T> service)