public class SharedServiceRegistryKF extends SimpleServiceRegistry implements SharedServiceRegistry, FeatureStateListener
This service registry is able to handle the following kind of services:
Proxy
instancesservices| Constructor and Description |
|---|
SharedServiceRegistryKF()
Creates a shared service registry.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getService(Class<T> serviceClass)
Gets the registered implementation for the given service.
|
<T> void |
register(Class<T> serviceClass,
T implementation)
Registers a service instance.
|
void |
stateChanged(Feature feature,
Feature.State previousState)
Called when the state of a Feature has changed.
|
<T> void |
unregister(Class<T> serviceClass,
T implementation)
Unregisters a service instance.
|
checkServicePermission, createAlternativeImplementation, putServicepublic SharedServiceRegistryKF()
@Nullable public <T> T getService(Class<T> serviceClass)
getService in interface ServiceLoadergetService in class SimpleServiceLoaderT - the service type.serviceClass - the service to found.null if no implementation is available.public <T> void register(Class<T> serviceClass, T implementation)
ServiceRegistry
The given instance is returned each time the service is requested by ServiceLoader.getService(Class).
If the service already has a registered instance, the previous one is replaced.
register in interface ServiceRegistryregister in class SimpleServiceRegistryT - the service type.serviceClass - the implemented service.implementation - the service instance.public void stateChanged(@Nullable Feature feature, @Nullable Feature.State previousState)
FeatureStateListenerstateChanged in interface FeatureStateListenerfeature - the Feature which state has changedpreviousState - the previous state, null if Feature state is Feature.State.INSTALLEDpublic <T> void unregister(Class<T> serviceClass, T implementation)
ServiceRegistryIf the given instance is not the one currently registered for the given service, nothing is done.
unregister in interface ServiceRegistryunregister in class SimpleServiceRegistryT - the service type.serviceClass - the implemented service.implementation - the service instance.