org.progeeks.util
Class ClassRegistry

java.lang.Object
  extended by org.progeeks.util.ClassRegistry

public class ClassRegistry
extends java.lang.Object

Class for relating objects to classes. This is slightly more involved than a simple map since a search is made up the class hierarchy.

Version:
$Revision: 1.6 $
Author:
Paul Speed

Constructor Summary
ClassRegistry()
           
ClassRegistry(ClassRegistry delegate)
           
 
Method Summary
 void clear()
          Clears this registry of all mappings.
 java.lang.Object get(java.lang.Class c)
           
 java.lang.Object get(java.lang.Class c, boolean searchSuperclasses)
          Returns the object associated with the specified class.
 void put(java.lang.Class c, java.lang.Object value)
          Maps the value to the specified type.
 void putAll(ClassRegistry registry)
          Adds any registry entries defined in the specified registry to this one.
 void setMappings(java.util.Map map)
          Sets the class registry mappings from a passed in Map.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassRegistry

public ClassRegistry()

ClassRegistry

public ClassRegistry(ClassRegistry delegate)
Method Detail

putAll

public void putAll(ClassRegistry registry)
Adds any registry entries defined in the specified registry to this one.


put

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


get

public java.lang.Object get(java.lang.Class c,
                            boolean searchSuperclasses)
Returns the object associated with the specified class. Search order goes: regular, delegate's regular, compatible super-types. When searching super-types, for each super-type the registry is checked first and then the delegate registry is checked before trying the next super-type.


get

public java.lang.Object get(java.lang.Class c)

clear

public void clear()
Clears this registry of all mappings.


setMappings

public void setMappings(java.util.Map map)
Sets the class registry mappings from a passed in Map. The keys of the map are either class objects or strings refering to fully qualified class objects.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2003 Paul Speed. All Rights Reserved.