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 java.lang.Object

Registers classes with aliases.


Field Summary
private static java.lang.String LABEL
          The string ""label""--the required name for a label field.
protected  java.util.Hashtable<java.lang.String,java.lang.Class<? extends B>> registry
          The Hashtable that stores the classes.
 
Constructor Summary
ClassRegistry(java.lang.String[] classnames)
          Loads the registry with a set of classes.
 
Method Summary
 java.lang.Class<? extends B> get(java.lang.String label)
          A wrapper for the internal Hashtable's get method.
 void register(java.lang.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 java.util.Hashtable<java.lang.String,java.lang.Class<? extends B>> registry
The Hashtable that stores the classes.


LABEL

private static final java.lang.String LABEL
The string ""label""--the required name for a label field.

See Also:
Constant Field Values
Constructor Detail

ClassRegistry

public ClassRegistry(java.lang.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(java.lang.String classname)
Registers an individual class.

Parameters:
classname - the name of the class to register

get

public java.lang.Class<? extends B> get(java.lang.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