public class MetaClassRegistryImpl extends java.lang.Object implements MetaClassRegistry
MetaClassRegistry.MetaClassCreationHandle
Modifier and Type | Field and Description |
---|---|
static int |
DONT_LOAD_DEFAULT |
static int |
LOAD_DEFAULT |
static java.lang.String |
MODULE_META_INF_FILE
Deprecated.
Use
instead |
Constructor and Description |
---|
MetaClassRegistryImpl() |
MetaClassRegistryImpl(boolean useAccessible) |
MetaClassRegistryImpl(int loadDefault) |
MetaClassRegistryImpl(int loadDefault,
boolean useAccessible) |
Modifier and Type | Method and Description |
---|---|
void |
addMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener)
Adds a listener for constant meta classes.
|
void |
addNonRemovableMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener)
Adds a listener for constant meta classes.
|
protected void |
fireConstantMetaClassUpdate(java.lang.Object obj,
java.lang.Class c,
MetaClass oldMC,
MetaClass newMc)
Causes the execution of all registered listeners.
|
static MetaClassRegistry |
getInstance(int includeExtension)
Singleton of MetaClassRegistry.
|
FastArray |
getInstanceMethods() |
MetaClass |
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
|
MetaClass |
getMetaClass(java.lang.Object obj) |
MetaClassRegistry.MetaClassCreationHandle |
getMetaClassCreationHandler()
Gets a handle internally used to create MetaClass implementations
WARNING: experimental code, likely to change soon
|
MetaClassRegistryChangeEventListener[] |
getMetaClassRegistryChangeEventListeners()
Gets an array of of all registered ConstantMetaClassListener instances.
|
ExtensionModuleRegistry |
getModuleRegistry() |
FastArray |
getStaticMethods() |
java.util.Iterator |
iterator()
Returns an iterator to iterate over all constant meta classes.
|
void |
registerExtensionModuleFromProperties(java.util.Properties properties,
java.lang.ClassLoader classLoader,
java.util.Map<CachedClass,java.util.List<MetaMethod>> map) |
void |
removeMetaClass(java.lang.Class theClass)
Removes a cached MetaClass from the registry
|
void |
removeMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener)
Removes a constant meta class listener.
|
void |
setMetaClass(java.lang.Class theClass,
MetaClass theMetaClass)
Registers a new MetaClass in the registry to customize the type
|
void |
setMetaClass(java.lang.Object obj,
MetaClass theMetaClass) |
void |
setMetaClassCreationHandle(MetaClassRegistry.MetaClassCreationHandle handle)
Sets a handle internally used to create MetaClass implementations.
|
boolean |
useAccessible() |
@Deprecated public static final java.lang.String MODULE_META_INF_FILE
instead
public static final int LOAD_DEFAULT
public static final int DONT_LOAD_DEFAULT
public MetaClassRegistryImpl()
public MetaClassRegistryImpl(int loadDefault)
public MetaClassRegistryImpl(boolean useAccessible)
useAccessible
- defines whether or not the AccessibleObject.setAccessible(boolean)
method will be called to enable access to all methods when using reflectionpublic MetaClassRegistryImpl(int loadDefault, boolean useAccessible)
public void registerExtensionModuleFromProperties(java.util.Properties properties, java.lang.ClassLoader classLoader, java.util.Map<CachedClass,java.util.List<MetaMethod>> map)
public ExtensionModuleRegistry getModuleRegistry()
public final MetaClass getMetaClass(java.lang.Class theClass)
MetaClassRegistry
getMetaClass
in interface MetaClassRegistry
public MetaClass getMetaClass(java.lang.Object obj)
public void removeMetaClass(java.lang.Class theClass)
MetaClassRegistry
removeMetaClass
in interface MetaClassRegistry
theClass
- The Java class of the MetaClass to removepublic void setMetaClass(java.lang.Class theClass, MetaClass theMetaClass)
setMetaClass
in interface MetaClassRegistry
theClass
- theMetaClass
- public void setMetaClass(java.lang.Object obj, MetaClass theMetaClass)
public boolean useAccessible()
public MetaClassRegistry.MetaClassCreationHandle getMetaClassCreationHandler()
getMetaClassCreationHandler
in interface MetaClassRegistry
public void setMetaClassCreationHandle(MetaClassRegistry.MetaClassCreationHandle handle)
setMetaClassCreationHandle
in interface MetaClassRegistry
handle
- the handlepublic void addMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener)
addMetaClassRegistryChangeEventListener
in interface MetaClassRegistry
listener
- the listenerpublic void addNonRemovableMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener)
addNonRemovableMetaClassRegistryChangeEventListener
in interface MetaClassRegistry
listener
- the listenerpublic void removeMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener)
removeMetaClassRegistryChangeEventListener
in interface MetaClassRegistry
listener
- the listenerprotected void fireConstantMetaClassUpdate(java.lang.Object obj, java.lang.Class c, MetaClass oldMC, MetaClass newMc)
obj
- object instance if the MetaClass change is on a per-instance metaclass (or null if global)c
- the classoldMC
- the old MetaClassnewMc
- the new MetaClasspublic MetaClassRegistryChangeEventListener[] getMetaClassRegistryChangeEventListeners()
getMetaClassRegistryChangeEventListeners
in interface MetaClassRegistry
public static MetaClassRegistry getInstance(int includeExtension)
includeExtension
- public FastArray getInstanceMethods()
public FastArray getStaticMethods()
public java.util.Iterator iterator()
iterator
in interface MetaClassRegistry