public class CompositeServiceLoader extends SimpleServiceLoader
services
Constructor and Description |
---|
CompositeServiceLoader()
Creates a new empty composite service loader.
|
Modifier and Type | Method and Description |
---|---|
void |
addServiceLoader(ServiceLoader serviceLoader)
Adds a service loader at the end of the list a service loaders used by this composite service loader.
|
<T> T |
getService(Class<T> service)
Gets the instance of the given service.
|
checkServicePermission, createAlternativeImplementation, putService
public CompositeServiceLoader()
public void addServiceLoader(ServiceLoader serviceLoader)
serviceLoader
- the service loader to add.NullPointerException
- if the given service loader is null
.@Nullable public <T> T getService(Class<T> service)
ServiceLoader
If there is already an instance in cache, it is returned otherwise a new one is created.
May return null
if the service is not defined.
getService
in interface ServiceLoader
getService
in class SimpleServiceLoader
T
- the service type.service
- the service.