|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.pietschy.command.configuration.impl.ConfiguratorRegistry
class ConfiguratorRegistry
This class provides an intelligent map for finding the best Configurator for a particular
Command subclass. If an exact match isn't found, the registry searches through all the
entries to find the configurator registered for the nearest ancestor.
| Field Summary | |
|---|---|
(package private) static java.lang.String |
_ID_
|
(package private) java.util.HashMap<java.lang.Class,Configurator> |
ancestors
|
(package private) java.util.HashMap<java.lang.Class,Configurator> |
configurators
|
| Constructor Summary | |
|---|---|
ConfiguratorRegistry()
Creates a new instance. |
|
| Method Summary | |
|---|---|
(package private) java.lang.Class |
findNearestAncestor(java.lang.Class clazz)
Finds the nearest ancestor of the specified class that has a registered configurator. |
Configurator |
get(Command command)
Gets the best configurator for the specified command class. |
(package private) int |
getLineage(java.lang.Class a,
java.lang.Class b)
Gets the lineage between the two specified classes. |
void |
register(java.lang.Class clazz,
Configurator configurator)
Registers the specified configurator for instances of the specified class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final java.lang.String _ID_
java.util.HashMap<java.lang.Class,Configurator> configurators
java.util.HashMap<java.lang.Class,Configurator> ancestors
| Constructor Detail |
|---|
public ConfiguratorRegistry()
| Method Detail |
|---|
public void register(java.lang.Class clazz,
Configurator configurator)
clazz - the command class.configurator - the configurator for the specified class.
java.lang.IllegalArgumentException - if clazz isn't of type Command.
java.lang.NullPointerException - if the configurator is null.public Configurator get(Command command)
command - the command to configure.java.lang.Class findNearestAncestor(java.lang.Class clazz)
clazz - the command class of interest.
int getLineage(java.lang.Class a,
java.lang.Class b)
a - the parent classb - the decendant class
java.lang.IllegalArgumentException - if b isn't an instance of a.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||