public interface ServiceLoader
Modifier and Type | Method and Description |
---|---|
<T> java.util.Collection<T> |
all(java.lang.Class<T> serviceClass)
Load multiple service implementations.
|
<T> T |
onlyOne(java.lang.Class<T> serviceClass)
Load a single service implementation.
|
<T> T |
onlyOne(java.lang.Class<T> serviceClass,
java.lang.Class<? extends T> defaultServiceClass)
Load a single service implementation.
|
<T> java.util.Collection<T> all(java.lang.Class<T> serviceClass)
T
- serviceClass
- The service interface to load a implementations forCollection
of all instances of serviceClass<T> T onlyOne(java.lang.Class<T> serviceClass)
IllegalStateException
if multiple instances of serviceClass found.T
- serviceClass
- The service interface to load a implementation forjava.lang.IllegalStateException
- if more then one implementation of serviceClass found<T> T onlyOne(java.lang.Class<T> serviceClass, java.lang.Class<? extends T> defaultServiceClass)
T
- serviceClass
- The service interface to load a implementation fordefaultServiceClass
- If no other implementations found, create a instance of this class