|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.chain.impl.CatalogBase
public class CatalogBase
Simple in-memory implementation of Catalog
. This class can
also be used as the basis for more advanced implementations.
This implementation is thread-safe.
Field Summary | |
---|---|
protected Map |
commands
The map of named Command s, keyed by name. |
Fields inherited from interface org.apache.commons.chain.Catalog |
---|
CATALOG_KEY |
Constructor Summary | |
---|---|
CatalogBase()
Create an empty catalog. |
|
CatalogBase(Map commands)
Create a catalog whose commands are those specified in the given Map . |
Method Summary | |
---|---|
void |
addCommand(String name,
Command command)
Add a new name and associated Command
to the set of named commands known to this Catalog ,
replacing any previous command for that name. |
Command |
getCommand(String name)
Return the Command associated with the
specified name, if any; otherwise, return null . |
Iterator |
getNames()
Return an Iterator over the set of named commands
known to this Catalog . |
String |
toString()
Converts this Catalog to a String. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Map commands
The map of named Command
s, keyed by name.
Constructor Detail |
---|
public CatalogBase()
public CatalogBase(Map commands)
Create a catalog whose commands are those specified in the given Map
.
All Map keys should be String
and all values should be Command
.
commands
- Map of Commands.Method Detail |
---|
public void addCommand(String name, Command command)
Add a new name and associated Command
to the set of named commands known to this Catalog
,
replacing any previous command for that name.
addCommand
in interface Catalog
name
- Name of the new commandcommand
- Command
to be returned
for later lookups on this namepublic Command getCommand(String name)
Return the Command
associated with the
specified name, if any; otherwise, return null
.
getCommand
in interface Catalog
name
- Name for which a Command
should be retrieved
public Iterator getNames()
Return an Iterator
over the set of named commands
known to this Catalog
. If there are no known commands,
an empty Iterator is returned.
getNames
in interface Catalog
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |