Groovy 1.7.0

groovy.lang
Interface MetaClassRegistry


interface MetaClassRegistry

A MetaClassRegistry is an object that is responsible for managing the a cache of MetaClass instances. Each java.lang.Class instance has an associated MetaClass and client code can query this interface for the MetaClass for a given associated java.lang.Class

see:
MetaClass
author:
John Wilson
author:
Graeme Rocher
author:
Jochen Theodorou


Nested Class Summary
class MetaClassRegistry.MetaClassCreationHandle

Class used as base for the creation of MetaClass implementations.

 
Method Summary
void addMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener)

adds a ConstantMetaClassChangeListener

MetaClass getMetaClass(Class theClass)

MetaClassCreationHandle getMetaClassCreationHandler()

Retrieves the MetaClassCreationHandle that is responsible for constructing MetaClass instances

MetaClassRegistryChangeEventListener[] getMetaClassRegistryChangeEventListeners()

Returns all registered ConstantMetaClassChangeListener objects.

Iterator iterator()

gets a snapshot of the current constant meta classes and returns it as Iterator.

void removeMetaClass(Class theClass)

Removes a cached MetaClass from the registry

void removeMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener)

removes a ConstantMetaClassChangeListener

void setMetaClass(Class theClass, MetaClass theMetaClass)

void setMetaClassCreationHandle(MetaClassCreationHandle handle)

Sets the MetaClassCreationHandle instance that is responsible for constructing instances

 

Method Detail

addMetaClassRegistryChangeEventListener

public void addMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener)
adds a ConstantMetaClassChangeListener
param:
listener - the update listener


getMetaClass

public MetaClass getMetaClass(Class theClass)


getMetaClassCreationHandler

public MetaClassCreationHandle getMetaClassCreationHandler()
Retrieves the MetaClassCreationHandle that is responsible for constructing MetaClass instances
return:
The MetaClassCreationHandle instance


getMetaClassRegistryChangeEventListeners

public MetaClassRegistryChangeEventListener[] getMetaClassRegistryChangeEventListeners()
Returns all registered ConstantMetaClassChangeListener objects.
return:
an array containing all change listener


iterator

public Iterator iterator()
gets a snapshot of the current constant meta classes and returns it as Iterator. Modifications done using this Iterator will not cause a ConcurrentMoidificationExcpetion. If a MetaClass is removed using this Iterator, then the MetaClass will only be removed if the MetaClass was not replaced by another MetaClass in the meantime. If a MetaClass is added while using this Iterator, then it will be part of the Iteration. If a MetaClass replaces another constant meta class, then the Iteration might show two meta classes for the same class.
This Iterator may not used in multiple threads.
return:
Iterator for the constant meta classes


removeMetaClass

public void removeMetaClass(Class theClass)
Removes a cached MetaClass from the registry
param:
theClass The Java class of the MetaClass to remove


removeMetaClassRegistryChangeEventListener

public void removeMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener)
removes a ConstantMetaClassChangeListener
param:
listener - the update listener


setMetaClass

public void setMetaClass(Class theClass, MetaClass theMetaClass)


setMetaClassCreationHandle

public void setMetaClassCreationHandle(MetaClassCreationHandle handle)
Sets the MetaClassCreationHandle instance that is responsible for constructing instances
param:
handle The handle instance


 

Copyright © 2003-2009 The Codehaus. All rights reserved.