Package ej.service.registry
Class SimpleServiceRegistry
- java.lang.Object
-
- ej.service.loader.SimpleServiceLoader
-
- ej.service.registry.SimpleServiceRegistry
-
- All Implemented Interfaces:
ServiceLoader,ServiceRegistry
- Direct Known Subclasses:
ServiceRegistryKF,SharedServiceRegistryKF
public class SimpleServiceRegistry extends SimpleServiceLoader implements ServiceRegistry
Service loader that creates service instance based on default service implementation class.
-
-
Field Summary
-
Fields inherited from class ej.service.loader.SimpleServiceLoader
services
-
-
Constructor Summary
Constructors Constructor Description SimpleServiceRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> voidregister(Class<T> service, T implementation)Registers a service instance.<T> voidunregister(Class<T> service, T implementation)Unregisters a service instance.-
Methods inherited from class ej.service.loader.SimpleServiceLoader
checkServicePermission, createAlternativeImplementation, getService, putService
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ej.service.ServiceLoader
getService
-
-
-
-
Method Detail
-
register
public <T> void register(Class<T> service, T implementation)
Description copied from interface:ServiceRegistryRegisters a service instance.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.
- Specified by:
registerin interfaceServiceRegistry- Type Parameters:
T- the service type.- Parameters:
service- the implemented service.implementation- the service instance.
-
unregister
public <T> void unregister(Class<T> service, T implementation)
Description copied from interface:ServiceRegistryUnregisters a service instance.If the given instance is not the one currently registered for the given service, nothing is done.
- Specified by:
unregisterin interfaceServiceRegistry- Type Parameters:
T- the service type.- Parameters:
service- the implemented service.implementation- the service instance.
-
-