org.aitools.programd.util
Class ClassRegistry<B>

java.lang.Object
  extended by org.aitools.programd.util.ClassRegistry<B>
Type Parameters:
B - the base class for classes that will be registered
Direct Known Subclasses:
ProcessorRegistry

public abstract class ClassRegistry<B>
extends Object

Registers classes with aliases.


Field Summary
protected  Hashtable<String,Class<? extends B>> registry
          The Hashtable that stores the classes.
 
Constructor Summary
ClassRegistry(String[] classnames)
          Loads the registry with a set of classes.
 
Method Summary
 Class<? extends B> get(String label)
          A wrapper for the internal Hashtable's get method.
 void register(String classname)
          Registers an individual class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

registry

protected Hashtable<String,Class<? extends B>> registry
The Hashtable that stores the classes.

Constructor Detail

ClassRegistry

public ClassRegistry(String[] classnames)
Loads the registry with a set of classes.

Parameters:
classnames - the names of the classes to register
Method Detail

register

public void register(String classname)
Registers an individual class.

Parameters:
classname - the name of the class to register

get

public Class<? extends B> get(String label)
                       throws NotARegisteredClassException
A wrapper for the internal Hashtable's get method.

Parameters:
label - the label of the Class desired.
Returns:
the Class corresponding to the given label.
Throws:
NotARegisteredClassException - if the given class is not registered