public interface ServiceLoader
Enum
s. See SpiServiceLoader
for default implementation.Modifier and Type | Method and Description |
---|---|
<T> Collection<T> |
all(Class<T> serviceClass)
Loads all registered services for given
serviceClass . |
<T> T |
onlyOne(Class<T> serviceClass)
Loads a registered service for given
serviceClass . |
<T> T |
onlyOne(Class<T> serviceClass,
Class<? extends T> defaultImplementationClass)
Loads a registered service for given
serviceClass . |
<T> Collection<T> all(Class<T> serviceClass) throws IllegalArgumentException
serviceClass
.serviceClass
- The service class.IllegalArgumentException
- If serviceClass
is null
.<T> T onlyOne(Class<T> serviceClass) throws IllegalArgumentException, IllegalStateException
serviceClass
.serviceClass
- The service class.IllegalArgumentException
- If serviceClass
is null
.IllegalStateException
- If more than a single service is registered.<T> T onlyOne(Class<T> serviceClass, Class<? extends T> defaultImplementationClass) throws IllegalArgumentException, IllegalStateException
serviceClass
. Reverts to the defaultImplementationClass
if no
other service is registered. If defaultImplemenationClass
is registered as well, it simply ignores it during
resolution.serviceClass
- The service class.defaultImplementationClass
- The default implementation class.IllegalArgumentException
- If either serviceClass
or defaultImplementationClass
is null
IllegalStateException
- If more than a single service is registeredCopyright © 2022 JBoss by Red Hat. All rights reserved.