|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.aduna.lang.service.ServiceRegistry<K,S>
public abstract class ServiceRegistry<K,S>
A registry that stores services by some key. Upon initialization, the registry searches for service description files at META-INF/services/<service class name> and initializes itself accordingly.
ServiceRegistry| Field Summary | |
|---|---|
protected org.slf4j.Logger |
logger
|
protected Map<K,S> |
services
|
| Constructor Summary | |
|---|---|
protected |
ServiceRegistry(Class<S> serviceClass)
|
| Method Summary | |
|---|---|
S |
add(S service)
Adds a service to the registry. |
S |
get(K key)
Gets the service for the specified key, if any. |
Collection<S> |
getAll()
Gets all registered services. |
protected abstract K |
getKey(S service)
Gets the key for the specified service. |
Set<K> |
getKeys()
Gets the set of registered keys. |
boolean |
has(K key)
Checks whether a service for the specified key is available. |
void |
remove(S service)
Removes a service from the registry. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.slf4j.Logger logger
protected Map<K,S> services
| Constructor Detail |
|---|
protected ServiceRegistry(Class<S> serviceClass)
| Method Detail |
|---|
public S add(S service)
getKey(Object)) will be
replaced with the new service.
service - The service that should be added to the registry.
public void remove(S service)
service - The service be removed from the registry.public S get(K key)
key - The key identifying which service to get.
public boolean has(K key)
key - The key identifying which service to search for.
public Collection<S> getAll()
public Set<K> getKeys()
protected abstract K getKey(S service)
service - The service to get the key for.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||