ecologylab.xml.types.scalar
Class TypeRegistry

java.lang.Object
  extended by ecologylab.generic.Debug
      extended by ecologylab.xml.types.scalar.TypeRegistry
Direct Known Subclasses:
XMLTools

public class TypeRegistry
extends Debug

This class implements a registry of instances of Type. Each key in this registry is the name of the Java type that underlies the Type, and not the name of the subclass of Type, itself.

Thus, for example, the key for the type translated by IntType is "int", not "IntType". It must be this way, because automatic translation is performed based on Field declarations, and the Field declarations do not know about these Types, only about the underlying Java types.


Constructor Summary
TypeRegistry()
           
 
Method Summary
static boolean contains(java.lang.Class thatClass)
          Check to see if we have a Type corresponding to the Class, by using its name.
static boolean contains(java.lang.String className)
          Check to see if we have a Type corresponding to the Class name.
static
<U> ScalarType<U>
getType(java.lang.Class<U> thatClass)
          Get the Scalar Type corresponding to the Class, by using its name.
static ScalarType getType(java.lang.reflect.Field field)
          Get the Type corresponding to the Field, by using the Field's Class.
static ScalarType getType(java.lang.String className)
          Get the Scalar Type corresponding to the Class name.
static boolean register(java.lang.Class<? extends ScalarType> typeClass)
          Enter this type in the registry, which is a map in which the Type's Class object's fully qualified named is used as a key.
 
Methods inherited from class ecologylab.generic.Debug
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, toString, warning, warning, weird, weird
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TypeRegistry

public TypeRegistry()
Method Detail

register

public static boolean register(java.lang.Class<? extends ScalarType> typeClass)
Enter this type in the registry, which is a map in which the Type's Class object's fully qualified named is used as a key.


getType

public static ScalarType getType(java.lang.reflect.Field field)
Get the Type corresponding to the Field, by using the Field's Class.

Parameters:
field -
Returns:
Type associated with the class of the specified Field

getType

public static <U> ScalarType<U> getType(java.lang.Class<U> thatClass)
Get the Scalar Type corresponding to the Class, by using its name.

Parameters:
thatClass -
Returns:
Type associated with thatClass

getType

public static final ScalarType getType(java.lang.String className)
Get the Scalar Type corresponding to the Class name.

Parameters:
className -
Returns:
Type associated with class of the specified name

contains

public static boolean contains(java.lang.Class thatClass)
Check to see if we have a Type corresponding to the Class, by using its name.

Parameters:
thatClass -
Returns:
true if thatClass is in this TypeRegistry

contains

public static boolean contains(java.lang.String className)
Check to see if we have a Type corresponding to the Class name.

Parameters:
className -
Returns:
true if a class with this name is in this TypeRegistry