public abstract class AbstractComponentRegistry<T> extends Object implements ComponentRegistry<T>
ComponentRegistry implementation that uses a HashMap to register and
reference target objects.| Constructor and Description |
|---|
AbstractComponentRegistry() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(String keyword,
T object)
Adds a new mapping in theregistry, with the given keyword and object value.
|
boolean |
exists(String keyword)
Tests to see if a mapping exists for the given keyword.
|
boolean |
exists(T object)
Tests to see if a given object is mapped in the registry.
|
T |
find(String keyword)
Returns the mapped object, given a keyword alias.
|
Iterable<T> |
getRegisteredComponents()
Returns only the registered objects, without their keyword aliases.
|
Map<String,T> |
getRegistry()
Returns the entire
Map of registered items. |
void |
setRegistry(Map<String,T> registry)
Sets the registry mappings, given a supplied
Map of keyword-object mappings. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddpublic T find(String keyword)
ComponentRegistryfind in interface ComponentRegistry<T>keyword - String value of the alias.public boolean exists(String keyword)
ComponentRegistryexists in interface ComponentRegistry<T>keyword - String keyword.public boolean exists(T object)
ComponentRegistryexists in interface ComponentRegistry<T>object - mappable object.public void add(String keyword, T object)
ComponentRegistryadd in interface ComponentRegistry<T>keyword - String alias for the object.object - The object to be registered.public Map<String,T> getRegistry()
ComponentRegistryMap of registered items.getRegistry in interface ComponentRegistry<T>public Iterable<T> getRegisteredComponents()
ComponentRegistrygetRegisteredComponents in interface ComponentRegistry<T>public void setRegistry(Map<String,T> registry)
ComponentRegistryMap of keyword-object mappings.setRegistry in interface ComponentRegistry<T>registry - map of aliases and objects.Copyright © 2016. All rights reserved.