- java.lang.Object
-
- jakarta.ws.rs.sse.FactoryFinder
-
final class FactoryFinder extends java.lang.ObjectFactory finder utility class.- Since:
- 2.1
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.LoggerLOGGER
-
Constructor Summary
Constructors Modifier Constructor Description privateFactoryFinder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static <T> java.lang.Objectfind(java.lang.String factoryId, java.lang.Class<T> service)Finds the implementationClassfor the given factory name and create its instance.private static <T> TfindFirstService(java.lang.String factoryId, java.lang.ClassLoader cl, java.lang.Class<T> service)private static java.lang.ClassLoadergetClassLoader()private static java.lang.ClassLoadergetContextClassLoader()private static java.lang.ObjectnewInstance(java.lang.String className, java.lang.ClassLoader classLoader)Creates an instance of the specified class using the specifiedClassLoaderobject.
-
-
-
Method Detail
-
getContextClassLoader
private static java.lang.ClassLoader getContextClassLoader()
-
newInstance
private static java.lang.Object newInstance(java.lang.String className, java.lang.ClassLoader classLoader) throws java.lang.ClassNotFoundExceptionCreates an instance of the specified class using the specifiedClassLoaderobject.- Parameters:
className- name of the class to be instantiated.classLoader- class loader to be used.- Returns:
- instance of the specified class.
- Throws:
java.lang.ClassNotFoundException- if the given class could not be found or could not be instantiated.
-
find
static <T> java.lang.Object find(java.lang.String factoryId, java.lang.Class<T> service) throws java.lang.ClassNotFoundExceptionFinds the implementationClassfor 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:
java.lang.ClassNotFoundException- if the given class could not be found or could not be instantiated.
-
getClassLoader
private static java.lang.ClassLoader getClassLoader()
-
findFirstService
private static <T> T findFirstService(java.lang.String factoryId, java.lang.ClassLoader cl, java.lang.Class<T> service)
-
-