Package com.nimbusds.common.spi
Class ServiceLoaderUtility
- java.lang.Object
-
- com.nimbusds.common.spi.ServiceLoaderUtility
-
public class ServiceLoaderUtility extends Object
Service (SPI) loader utility.
-
-
Constructor Summary
Constructors Constructor Description ServiceLoaderUtility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Set<T>
loadMultiple(Class<T> tClass, T defaultImpl)
Loads multiple Service Provider Interface (SPI) implementations.static <T> T
loadSingle(Class<T> tClass, T defaultImpl)
Loads a single Service Provider Interface (SPI) implementation.
-
-
-
Constructor Detail
-
ServiceLoaderUtility
public ServiceLoaderUtility()
-
-
Method Detail
-
loadSingle
public static <T> T loadSingle(Class<T> tClass, T defaultImpl)
Loads a single Service Provider Interface (SPI) implementation.- Parameters:
tClass
- The SPI. Notnull
.defaultImpl
- The default implementation,null
if not specified.- Returns:
- The loaded SPI implementation or the default one.
- Throws:
RuntimeException
- If more than one SPI implementation was found.
-
loadMultiple
public static <T> Set<T> loadMultiple(Class<T> tClass, T defaultImpl)
Loads multiple Service Provider Interface (SPI) implementations.- Parameters:
tClass
- The SPI. Notnull
.defaultImpl
- The default implementation,null
if not specified.- Returns:
- The loaded SPI implementations, if none were loaded and a default was specified, a singleton set with it.
-
-