Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.progeeks.meta
Class TypeRegistry  view TypeRegistry download TypeRegistry.java

java.lang.Object
  extended byorg.progeeks.meta.TypeRegistry

public class TypeRegistry
extends java.lang.Object

Class for relating objects to types. This is slightly more involved than a simple map since some types can be broken down further to find better values.

Version:
$Revision: 1.2 $

Field Summary
private  java.util.Map baseTypes
          Maps base types to values.
private  TypeRegistry delegate
          A registry to check when values aren't found in this registry.
private  java.util.Map types
          Maps property types to values.
 
Constructor Summary
TypeRegistry()
           
TypeRegistry(TypeRegistry delegate)
           
 
Method Summary
 java.lang.Object get(PropertyType type)
           
 java.lang.Object get(PropertyType type, boolean searchDefaults)
          Returns the object associated with the specified type.
 java.lang.Object getDefault(PropertyType type)
           
 void put(PropertyType type, java.lang.Object value)
          Maps the value to the specified type.
 void putDefault(java.lang.Class baseType, java.lang.Object value)
          Maps the value with a default base type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegate

private TypeRegistry delegate
A registry to check when values aren't found in this registry.


types

private java.util.Map types
Maps property types to values.


baseTypes

private java.util.Map baseTypes
Maps base types to values. This map is checked when a type is not found in the types map.

Constructor Detail

TypeRegistry

public TypeRegistry()

TypeRegistry

public TypeRegistry(TypeRegistry delegate)
Method Detail

put

public void put(PropertyType type,
                java.lang.Object value)
Maps the value to the specified type.


putDefault

public void putDefault(java.lang.Class baseType,
                       java.lang.Object value)
Maps the value with a default base type. The defaults are checked when a specific property type is not found.


get

public java.lang.Object get(PropertyType type,
                            boolean searchDefaults)
Returns the object associated with the specified type. Search order goes: regular, delegate's regular, compatible super-types, defaults, delegate's defaults.


get

public java.lang.Object get(PropertyType type)

getDefault

public java.lang.Object getDefault(PropertyType type)