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

Quick Search    Search Deep

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

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

public class MetaClassRegistry
extends java.lang.Object

A registry of MetaClasses that can be looked up by name. The MetaClassRegistry acts as sort of a class-loader in meta-space. Each MetaClass knows which class registry it belongs to and can use this information to look up information about related classes.

Version:
$Revision: 1.3 $

Field Summary
private  java.util.Map classes
          Maps class names to MetaClasses.
private  int delegationPolicy
          Designates how this class loader will delegate to it's parent.
static int LOOKUP_LOCAL_FIRST
           
static int LOOKUP_LOCAL_ONLY
           
static int LOOKUP_PARENT_FIRST
           
private  MetaClassRegistry parentRegistry
          The parent registry to this class registry.
private static MetaClassRegistry rootRegistry
          A default "root" class registry to which all class registry chains eventually defer.
 
Constructor Summary
MetaClassRegistry()
          Creates a new meta-class registry that delegates to the root registry after looking for a class locally.
MetaClassRegistry(int delegationPolicy)
          Creates a new meta-class registry the delegates to the root registry as specified by the delegation policy parameter.
MetaClassRegistry(MetaClassRegistry parentRegistry)
          Creates a new meta-class registry the delegates to the specified parent registry after looking for a class locally.
MetaClassRegistry(MetaClassRegistry parentRegistry, int delegationPolicy)
          Creates a new meta-class registry the delegates to the specified parent registry as specified by the delegation policy parameter.
 
Method Summary
 MetaClass createMetaClass(java.lang.String name, java.util.List propertyInfos)
          Creates a meta-class from the specified information.
 MetaClass createMetaClass(java.lang.String name, java.util.List propertyInfos, java.util.List superclasses)
          Creates a meta-class from the specified information.
 MetaClass createMetaClass(java.lang.String name, java.util.List propertyInfos, MetaClass superclass)
          Creates a meta-class from the specified information.
 boolean exists(java.lang.String name)
          Returns true if the specified class name has a meta-class associated with it.
 int getDelegationPolicy()
          Returns the policy used to determine how this class registry interacts with its parent registry.
 MetaClass getMetaClass(java.lang.String name)
          Retrieves the meta-class associated with the specified class name.
 MetaClassRegistry getParentRegistry()
          Returns the parent registry to this meta-class registry or null if there is no parent registry.
static MetaClassRegistry getRootRegistry()
          Returns the singleton instance of the root class registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOOKUP_PARENT_FIRST

public static final int LOOKUP_PARENT_FIRST
See Also:
Constant Field Values

LOOKUP_LOCAL_FIRST

public static final int LOOKUP_LOCAL_FIRST
See Also:
Constant Field Values

LOOKUP_LOCAL_ONLY

public static final int LOOKUP_LOCAL_ONLY
See Also:
Constant Field Values

rootRegistry

private static MetaClassRegistry rootRegistry
A default "root" class registry to which all class registry chains eventually defer. This is similar to the system classloader in real-class space.


classes

private java.util.Map classes
Maps class names to MetaClasses.


parentRegistry

private MetaClassRegistry parentRegistry
The parent registry to this class registry.


delegationPolicy

private int delegationPolicy
Designates how this class loader will delegate to it's parent.

Constructor Detail

MetaClassRegistry

public MetaClassRegistry()
Creates a new meta-class registry that delegates to the root registry after looking for a class locally.


MetaClassRegistry

public MetaClassRegistry(int delegationPolicy)
Creates a new meta-class registry the delegates to the root registry as specified by the delegation policy parameter.


MetaClassRegistry

public MetaClassRegistry(MetaClassRegistry parentRegistry)
Creates a new meta-class registry the delegates to the specified parent registry after looking for a class locally.


MetaClassRegistry

public MetaClassRegistry(MetaClassRegistry parentRegistry,
                         int delegationPolicy)
Creates a new meta-class registry the delegates to the specified parent registry as specified by the delegation policy parameter.

Method Detail

getRootRegistry

public static MetaClassRegistry getRootRegistry()
Returns the singleton instance of the root class registry.


getParentRegistry

public MetaClassRegistry getParentRegistry()
Returns the parent registry to this meta-class registry or null if there is no parent registry.


getDelegationPolicy

public int getDelegationPolicy()
Returns the policy used to determine how this class registry interacts with its parent registry.


createMetaClass

public MetaClass createMetaClass(java.lang.String name,
                                 java.util.List propertyInfos)
Creates a meta-class from the specified information. The created class will be added to this registry, replacing any existing meta-class for the specified name. This is a factory method that can insulate callers from the specifics of creating a meta-class and makes sure the meta-class is associated with the correct registry.


createMetaClass

public MetaClass createMetaClass(java.lang.String name,
                                 java.util.List propertyInfos,
                                 java.util.List superclasses)
Creates a meta-class from the specified information. The created class will be added to this registry, replacing any existing meta-class for the specified name. This is a factory method that can insulate callers from the specifics of creating a meta-class and makes sure the meta-class is associated with the correct registry.


createMetaClass

public MetaClass createMetaClass(java.lang.String name,
                                 java.util.List propertyInfos,
                                 MetaClass superclass)
Creates a meta-class from the specified information. The created class will be added to this registry, replacing any existing meta-class for the specified name. This is a factory method that can insulate callers from the specifics of creating a meta-class and makes sure the meta-class is associated with the correct registry.


getMetaClass

public MetaClass getMetaClass(java.lang.String name)
Retrieves the meta-class associated with the specified class name.


exists

public boolean exists(java.lang.String name)
Returns true if the specified class name has a meta-class associated with it.