public class MetaClassRegistryImpl extends Object
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Modifiers | Name | Description |
---|---|---|
static int |
DONT_LOAD_DEFAULT |
|
static int |
LOAD_DEFAULT |
|
static String |
MODULE_META_INF_FILE |
@deprecated Use instead |
Constructor and description |
---|
MetaClassRegistryImpl
() |
MetaClassRegistryImpl
(int loadDefault) |
MetaClassRegistryImpl
(boolean useAccessible) @param useAccessible defines whether or not the AccessibleObject.setAccessible method will be called to enable access to all methods when using reflection |
MetaClassRegistryImpl
(int loadDefault, boolean useAccessible) |
Type | Name 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(Object obj, 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(Class theClass) |
MetaClass |
getMetaClass(Object obj) |
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() |
Iterator |
iterator() Returns an iterator to iterate over all constant meta classes. |
void |
registerExtensionModuleFromProperties(Properties properties, ClassLoader classLoader, Map<CachedClass, List<MetaMethod>> map) |
void |
removeMetaClass(Class theClass) |
void |
removeMetaClassRegistryChangeEventListener(MetaClassRegistryChangeEventListener listener) Removes a constant meta class listener. |
void |
setMetaClass(Class theClass, MetaClass theMetaClass) Registers a new MetaClass in the registry to customize the type |
void |
setMetaClass(Object obj, MetaClass theMetaClass) |
void |
setMetaClassCreationHandle(MetaClassCreationHandle handle) Sets a handle internally used to create MetaClass implementations. |
boolean |
useAccessible() |
useAccessible
- defines whether or not the AccessibleObject.setAccessible
method will be called to enable access to all methods when using reflectionAdds a listener for constant meta classes.
listener
- the listenerAdds a listener for constant meta classes. This listener cannot be removed!
listener
- the listenerCauses the execution of all registered listeners. This method is used mostly internal to kick of the listener notification. It can also be used by subclasses to achieve the same.
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 MetaClassSingleton of MetaClassRegistry.
Gets a handle internally used to create MetaClass implementations WARNING: experimental code, likely to change soon
Gets an array of of all registered ConstantMetaClassListener instances.
Returns an iterator to iterate over all constant meta classes. This iterator can be seen as making a snapshot of the current state of the registry. The snapshot will include all meta classes that has been used unless they are already collected. Collected meta classes will be skipped automatically, so you can expect that each element of the iteration is not null. Calling this method is thread safe, the usage of the iterator is not.
Removes a constant meta class listener.
listener
- the listenerRegisters a new MetaClass in the registry to customize the type
Sets a handle internally used to create MetaClass implementations. When replacing the handle with a custom version, you should reuse the old handle to keep custom logic and to use the default logic as fall back. WARNING: experimental code, likely to change soon
handle
- the handleCopyright © 2003-2015 The Apache Software Foundation. All rights reserved.