Class ServiceFactory
java.lang.Object
com.pingidentity.sdk.internal.services.ServiceFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetImplClasses(Class<T> clazz) Acquires the list of implementation classes when multiple classes may be provided.static <T> TgetSingleImpl(Class<T> clazz, ArgPair<?>... args) Acquires the implementation when one and only one implementation is expected.
-
Constructor Details
-
ServiceFactory
public ServiceFactory()
-
-
Method Details
-
getImplClasses
Acquires the list of implementation classes when multiple classes may be provided.- Type Parameters:
T- The interface type.- Parameters:
clazz- The class representing the interface for which to look for registered implementations.- Returns:
- The list of types provided. Ordering is based on classloader behavior and should not be depended upon. (never null)
-
getSingleImpl
Acquires the implementation when one and only one implementation is expected. Provides an instance if the first instance encountered is instantiable. Logs warnings if there are more than 1 impls available. Returned impl type is based upon classloader behavior and may be non-deterministic.- Type Parameters:
T- The interface type.- Parameters:
clazz- The class representing the Interface for which to look for registered implementations.- Returns:
- A instance of the impl created using the no-argument constructor.
- Throws:
RuntimeException- when errors are encountered.
-