Package com.bc.ceres.core
Class DefaultServiceRegistry<T>
- java.lang.Object
- 
- com.bc.ceres.core.DefaultServiceRegistry<T>
 
- 
- All Implemented Interfaces:
- ServiceRegistry<T>
 
 public class DefaultServiceRegistry<T> extends Object implements ServiceRegistry<T> 
- 
- 
Constructor SummaryConstructors Constructor Description DefaultServiceRegistry(Class<T> serviceType)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(ServiceRegistryListener<T> listener)Adds a new registry listener.booleanaddService(T service)Adds a new service to this registry.List<ServiceRegistryListener<T>>getListeners()TgetService(String className)Gets a registered service instance for the given class name.Set<T>getServices()Gets all registered services.Class<T>getServiceType()Gets the service type.voidremoveListener(ServiceRegistryListener<T> listener)Removes an existing registry listener.booleanremoveService(T service)Removes an existing service from this registry.
 
- 
- 
- 
Method Detail- 
getServiceTypepublic Class<T> getServiceType() Gets the service type. All services in this registry are instances of this type.- Specified by:
- getServiceTypein interface- ServiceRegistry<T>
- Returns:
- The service type.
 
 - 
getServicespublic Set<T> getServices() Gets all registered services.- Specified by:
- getServicesin interface- ServiceRegistry<T>
- Returns:
- A set of all services.
 
 - 
getServicepublic T getService(String className) Gets a registered service instance for the given class name.- Specified by:
- getServicein interface- ServiceRegistry<T>
- Parameters:
- className- The name of the service's class.
- Returns:
- The service instance or nullif no such exists.
 
 - 
addServicepublic boolean addService(T service) Adds a new service to this registry. The method will automatically remove an already registered service of the same type. If the registry changes due to a call of this method, a change event will be fired.- Specified by:
- addServicein interface- ServiceRegistry<T>
- Parameters:
- service- The service to be added.
- Returns:
- trueif the service has been added.
 
 - 
removeServicepublic boolean removeService(T service) Removes an existing service from this registry. If the registry changes due to a call of this method, a change event will be fired.- Specified by:
- removeServicein interface- ServiceRegistry<T>
- Parameters:
- service- The service to be removed.
- Returns:
- trueif the service has been removed.
 
 - 
getListenerspublic List<ServiceRegistryListener<T>> getListeners() - Specified by:
- getListenersin interface- ServiceRegistry<T>
- Returns:
- The list of registry listeners.
 
 - 
addListenerpublic void addListener(ServiceRegistryListener<T> listener) Adds a new registry listener.- Specified by:
- addListenerin interface- ServiceRegistry<T>
- Parameters:
- listener- The registry listener to be added.
 
 - 
removeListenerpublic void removeListener(ServiceRegistryListener<T> listener) Removes an existing registry listener.- Specified by:
- removeListenerin interface- ServiceRegistry<T>
- Parameters:
- listener- The registry listener to be removed.
 
 
- 
 
-