Package groovy.lang
Interface MetaClassRegistry
- 
- All Known Implementing Classes:
- MetaClassRegistryImpl
 
 public interface MetaClassRegistryA 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 Also:
- MetaClass
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static classMetaClassRegistry.MetaClassCreationHandleClass used as base for the creation of MetaClass implementations.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener)Adds a meta class change listener for constant meta classesvoidaddNonRemovableMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener)Adds a meta class change listener for constant meta classes.MetaClassgetMetaClass(java.lang.Class theClass)The main function of the registry If a meta class exists then return it otherwise create one, put it in the registry and return itMetaClassRegistry.MetaClassCreationHandlegetMetaClassCreationHandler()Retrieves the MetaClassCreationHandle that is responsible for constructing MetaClass instancesMetaClassRegistryChangeEventListener[]getMetaClassRegistryChangeEventListeners()Returns all registered class change listener for constant meta classes.java.util.Iteratoriterator()Gets a snapshot of the current constant meta classes and returns it as Iterator.voidremoveMetaClass(java.lang.Class theClass)Removes a cached MetaClass from the registryvoidremoveMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener)Removes a meta class change listener for constant meta classesvoidsetMetaClass(java.lang.Class theClass, MetaClass theMetaClass)Adds a metaclass to the registry for the given classvoidsetMetaClassCreationHandle(MetaClassRegistry.MetaClassCreationHandle handle)Sets the MetaClassCreationHandle instance that is responsible for constructing instances
 
- 
- 
- 
Method Detail- 
getMetaClassMetaClass getMetaClass(java.lang.Class theClass) The main function of the registry If a meta class exists then return it otherwise create one, put it in the registry and return it
 - 
setMetaClassvoid setMetaClass(java.lang.Class theClass, MetaClass theMetaClass)Adds a metaclass to the registry for the given class- Parameters:
- theClass- The class
- theMetaClass- The MetaClass for theClass
 
 - 
removeMetaClassvoid removeMetaClass(java.lang.Class theClass) Removes a cached MetaClass from the registry- Parameters:
- theClass- The Java class of the MetaClass to remove
 
 - 
getMetaClassCreationHandlerMetaClassRegistry.MetaClassCreationHandle getMetaClassCreationHandler() Retrieves the MetaClassCreationHandle that is responsible for constructing MetaClass instances- Returns:
- The MetaClassCreationHandle instance
 
 - 
setMetaClassCreationHandlevoid setMetaClassCreationHandle(MetaClassRegistry.MetaClassCreationHandle handle) Sets the MetaClassCreationHandle instance that is responsible for constructing instances- Parameters:
- handle- The handle instance
 
 - 
addMetaClassRegistryChangeEventListenervoid addMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener) Adds a meta class change listener for constant meta classes- Parameters:
- listener- - the update listener
 
 - 
addNonRemovableMetaClassRegistryChangeEventListenervoid addNonRemovableMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener) Adds a meta class change listener for constant meta classes. This listener cannot be removed!- Parameters:
- listener- - the update listener
 
 - 
removeMetaClassRegistryChangeEventListenervoid removeMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener) Removes a meta class change listener for constant meta classes- Parameters:
- listener- - the update listener
 
 - 
getMetaClassRegistryChangeEventListenersMetaClassRegistryChangeEventListener[] getMetaClassRegistryChangeEventListeners() Returns all registered class change listener for constant meta classes.- Returns:
- an array containing all change listener
 
 - 
iteratorjava.util.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 ConcurrentModificationException. 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.Note: This Iterator may not used with multiple threads. - Returns:
- Iterator for the constant meta classes
 
 
- 
 
-