public class ServiceRegistryLoader extends Object implements ServiceLoader
Constructor and Description |
---|
ServiceRegistryLoader(Injector injector,
ServiceRegistry registry) |
Modifier and Type | Method and Description |
---|---|
<T> Collection<T> |
all(Class<T> serviceClass)
Load multiple service implementations.
|
<T> T |
onlyOne(Class<T> serviceClass)
Load a single service implementation.
|
<T> T |
onlyOne(Class<T> serviceClass,
Class<? extends T> defaultServiceClass)
Load a single service implementation.
|
public ServiceRegistryLoader(Injector injector, ServiceRegistry registry)
public <T> Collection<T> all(Class<T> serviceClass)
ServiceLoader
all
in interface ServiceLoader
serviceClass
- The service interface to load a implementations forCollection
of all instances of serviceClasspublic <T> T onlyOne(Class<T> serviceClass)
ServiceLoader
IllegalStateException
if multiple instances of serviceClass found.onlyOne
in interface ServiceLoader
serviceClass
- The service interface to load a implementation forpublic <T> T onlyOne(Class<T> serviceClass, Class<? extends T> defaultServiceClass)
ServiceLoader
onlyOne
in interface ServiceLoader
serviceClass
- The service interface to load a implementation fordefaultServiceClass
- If no other implementations found, create a instance of this classCopyright © 2012 JBoss by Red Hat. All Rights Reserved.