|
ShrinkWrap Resolver SPI 2.0.0-cr-1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.shrinkwrap.resolver.spi.loader.SpiServiceLoader
public class SpiServiceLoader
A basic ServiceLoader implementation which uses META-INF/services registration.
In order to register a service, create a file META-INF/services/${service.interface.name}. The content of the file should
list fully qualified names of interface implementations, separated by new line character.
| Constructor Summary | |
|---|---|
SpiServiceLoader()
Create an instance of SPI service loader |
|
SpiServiceLoader(ClassLoader classLoader)
Creates an instance of SPI service loader. |
|
| Method Summary | ||
|---|---|---|
|
all(Class<T> serviceClass)
Loads all registered services for given serviceClass |
|
ClassLoader |
getClassLoader()
|
|
|
onlyOne(Class<T> serviceClass)
Loads a registered service for given serviceClass |
|
|
onlyOne(Class<T> serviceClass,
Class<? extends T> defaultImplementationClass)
Loads a registered service for given serviceClass. |
|
void |
setClassLoader(ClassLoader classLoader)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SpiServiceLoader()
public SpiServiceLoader(ClassLoader classLoader)
ClassLoader to load service implementations.
classLoader - | Method Detail |
|---|
public <T> Collection<T> all(Class<T> serviceClass)
ServiceLoaderserviceClass
all in interface ServiceLoaderpublic <T> T onlyOne(Class<T> serviceClass)
ServiceLoaderserviceClass
onlyOne in interface ServiceLoader
public <T> T onlyOne(Class<T> serviceClass,
Class<? extends T> defaultImplementationClass)
ServiceLoaderserviceClass. Reverts to the defaultImplementationClass if no
other service is registered. If defaultImplemenationClass is registered as well, it simply ignores it during
resolution.
onlyOne in interface ServiceLoaderpublic ClassLoader getClassLoader()
public void setClassLoader(ClassLoader classLoader)
|
ShrinkWrap Resolver SPI 2.0.0-cr-1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||