Package org.apache.commons.chain.impl
Class CatalogBase<C extends Context>
java.lang.Object
org.apache.commons.chain.impl.CatalogBase<C>
- Type Parameters:
C
- Type of the context associated with this catalog
- All Implemented Interfaces:
Catalog<C>
Simple in-memory implementation of
Catalog
. This class can
also be used as the basis for more advanced implementations.
This implementation is thread-safe.
- Version:
- $Revision$ $Date$
- Author:
- Craig R. McClanahan, Matthew J. Sgarlata
-
Field Summary
Fields inherited from interface org.apache.commons.chain.Catalog
CATALOG_KEY
-
Constructor Summary
ConstructorDescriptionCreate an empty catalog.CatalogBase
(Map<String, Command<C>> commands) Create a catalog whose commands are those specified in the givenMap
. -
Method Summary
Modifier and TypeMethodDescriptionaddCommand
(String name, CMD command) getCommand
(String name) Return theCommand
associated with the specified name, if any; otherwise, returnnull
.getNames()
Return anIterator
over the set of named commands known to thisCatalog
.toString()
Converts this Catalog to a String.
-
Constructor Details
-
CatalogBase
public CatalogBase()Create an empty catalog. -
CatalogBase
Create a catalog whose commands are those specified in the givenMap
. All Map keys should beString
and all values should beCommand
.- Parameters:
commands
- Map of Commands.- Since:
- Chain 1.1
-
-
Method Details
-
addCommand
-
getCommand
Return theCommand
associated with the specified name, if any; otherwise, returnnull
. -
getNames
Return anIterator
over the set of named commands known to thisCatalog
. If there are no known commands, an empty Iterator is returned. -
toString
Converts this Catalog to a String. Useful for debugging purposes.
-