org.codehaus.groovy.runtime.metaclass
[Java] Class ClosureMetaClass
java.lang.Object
groovy.lang.MetaClassImpl
org.codehaus.groovy.runtime.metaclass.ClosureMetaClass
public final class ClosureMetaClass
extends MetaClassImpl
A meta class for closures generated by the Groovy compiler. These classes
have special characteristics this MetaClass uses. One of these is that a
generated Closure has only additional doCall methods, all other methods
are in the Closure class as well. To use this fact this MetaClass uses
a MetaClass for Closure as static field And delegates calls to this
MetaClass if needed. This allows a lean implementation for this MetaClass.
Multiple generated closures will then use the same MetaClass for Closure.
For static dispatching this class uses the MetaClass of Class, again
all instances of this class will share that MetaClass. The Class MetaClass
is initialized lazy, because most operations do not need this MetaClass.
The Closure and Class MetaClasses are not replaceable.
This MetaClass is for internal usage only!
- Authors:
- Jochen Theodorou
- Since:
- 1.5
Fields inherited from class MetaClassImpl
|
INVOKE_METHOD_METHOD, METHOD_MISSING, PROPERTY_MISSING, STATIC_METHOD_MISSING, STATIC_PROPERTY_MISSING, getPropertyMethod, invokeMethodMethod, isGroovyObject, isMap, metaMethodIndex, registry, setPropertyMethod, theCachedClass, theClass |
Method Summary |
def
|
ClosureMetaClass(MetaClassRegistry registry, Class theClass)
|
void
|
addMetaBeanProperty(MetaBeanProperty mp)
|
void
|
addMetaMethod(MetaMethod method)
|
void
|
addNewInstanceMethod(Method method)
|
void
|
addNewStaticMethod(Method method)
|
protected void
|
applyPropertyDescriptors(PropertyDescriptor[] propertyDescriptors)
|
CallSite
|
createPogoCallCurrentSite(CallSite site, Class sender, Object[] args)
|
CallSite
|
createPogoCallSite(CallSite site, Object[] args)
|
CallSite
|
createPojoCallSite(CallSite site, Object receiver, Object[] args)
|
Object
|
getAttribute(Class sender, Object object, String attribute, boolean useSuper, boolean fromInsideClass)
|
List
|
getMetaMethods()
|
MetaProperty
|
getMetaProperty(String name)
|
MetaMethod
|
getMethodWithoutCaching(int index, Class sender, String methodName, Class[] arguments, boolean isCallToSuper)
|
List
|
getMethods()
|
List
|
getProperties()
|
Object
|
getProperty(Class sender, Object object, String name, boolean useSuper, boolean fromInsideClass)
|
MetaMethod
|
getStaticMetaMethod(String name, Object[] args)
|
MetaMethod
|
getStaticMetaMethod(String name, Class[] argTypes)
|
void
|
initialize()
|
Object
|
invokeMethod(Class sender, Object object, String methodName, Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass)
|
Object
|
invokeStaticMethod(Object object, String methodName, Object[] arguments)
|
protected boolean
|
isInitialized()
|
MetaMethod
|
pickMethod(String name, Class[] argTypes)
|
List
|
respondsTo(Object obj, String name, Object[] argTypes)
|
List
|
respondsTo(Object obj, String name)
|
Constructor
|
retrieveConstructor(Class[] arguments)
|
MetaMethod
|
retrieveStaticMethod(String methodName, Class[] arguments)
|
void
|
setAttribute(Class sender, Object object, String attribute, Object newValue, boolean useSuper, boolean fromInsideClass)
|
void
|
setProperties(Object bean, Map map)
|
void
|
setProperty(Class sender, Object object, String name, Object newValue, boolean useSuper, boolean fromInsideClass)
|
Methods inherited from class MetaClassImpl
|
addMetaBeanProperty, addMetaMethod, addMetaMethodToIndex, addNewInstanceMethod, addNewStaticMethod, applyPropertyDescriptors, checkIfGroovyObjectMethod, checkInitalised, chooseMethod, clearInvocationCaches, createConstructorSite, createPogoCallCurrentSite, createPogoCallSite, createPojoCallSite, createStaticSite, dropMethodCache, dropStaticMethodCache, findMethodInClassHierarchy, findMixinMethod, findOwnMethod, findPropertyInClassHierarchy, getAdditionalMetaMethods, getAttribute, getAttribute, getAttribute, getClassInfo, getClassNode, getEffectiveGetMetaProperty, getMetaMethod, getMetaMethods, getMetaProperty, getMethodWithCaching, getMethodWithoutCaching, getMethods, getProperties, getProperty, getProperty, getStaticMetaMethod, getSubclassMetaMethods, getSuperClasses, getTheCachedClass, getTheClass, getVersion, hasProperty, incVersion, initialize, invokeConstructor, invokeConstructorAt, invokeMethod, invokeMethod, invokeMethod, invokeMissingMethod, invokeMissingProperty, invokeStaticMethod, invokeStaticMissingProperty, isGroovyObject, isInitialized, isModified, onGetPropertyFoundInHierarchy, onInvokeMethodFoundInHierarchy, onMixinMethodFound, onSetPropertyFoundInHierarchy, onSuperMethodFoundInHierarchy, onSuperPropertyFoundInHierarchy, pickMethod, respondsTo, respondsTo, retrieveConstructor, retrieveMethod, retrieveStaticMethod, selectConstructorAndTransformArguments, setAttribute, setAttribute, setProperties, setProperty, setProperty, toString |
ClosureMetaClass
public def ClosureMetaClass(MetaClassRegistry registry, Class theClass)
-
addMetaBeanProperty
public void addMetaBeanProperty(MetaBeanProperty mp)
-
addMetaMethod
public void addMetaMethod(MetaMethod method)
-
addNewInstanceMethod
public void addNewInstanceMethod(Method method)
-
addNewStaticMethod
public void addNewStaticMethod(Method method)
-
applyPropertyDescriptors
protected void applyPropertyDescriptors(PropertyDescriptor[] propertyDescriptors)
-
createPogoCallCurrentSite
public CallSite createPogoCallCurrentSite(CallSite site, Class sender, Object[] args)
-
createPogoCallSite
public CallSite createPogoCallSite(CallSite site, Object[] args)
-
createPojoCallSite
public CallSite createPojoCallSite(CallSite site, Object receiver, Object[] args)
-
getAttribute
@Override
public Object getAttribute(Class sender, Object object, String attribute, boolean useSuper, boolean fromInsideClass)
-
getMetaMethods
@Override
public List getMetaMethods()
-
getMetaProperty
public MetaProperty getMetaProperty(String name)
-
getMethodWithoutCaching
public MetaMethod getMethodWithoutCaching(int index, Class sender, String methodName, Class[] arguments, boolean isCallToSuper)
-
getMethods
@Override
public List getMethods()
-
getProperties
@Override
public List getProperties()
-
getProperty
public Object getProperty(Class sender, Object object, String name, boolean useSuper, boolean fromInsideClass)
-
getStaticMetaMethod
public MetaMethod getStaticMetaMethod(String name, Object[] args)
-
getStaticMetaMethod
public MetaMethod getStaticMetaMethod(String name, Class[] argTypes)
-
initialize
public void initialize()
-
invokeMethod
public Object invokeMethod(Class sender, Object object, String methodName, Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass)
-
invokeStaticMethod
public Object invokeStaticMethod(Object object, String methodName, Object[] arguments)
-
isInitialized
protected boolean isInitialized()
-
pickMethod
@Override
public MetaMethod pickMethod(String name, Class[] argTypes)
-
respondsTo
public List respondsTo(Object obj, String name, Object[] argTypes)
-
respondsTo
public List respondsTo(Object obj, String name)
-
retrieveConstructor
public Constructor retrieveConstructor(Class[] arguments)
-
retrieveStaticMethod
public MetaMethod retrieveStaticMethod(String methodName, Class[] arguments)
-
setAttribute
@Override
public void setAttribute(Class sender, Object object, String attribute, Object newValue, boolean useSuper, boolean fromInsideClass)
-
setProperties
public void setProperties(Object bean, Map map)
-
setProperty
public void setProperty(Class sender, Object object, String name, Object newValue, boolean useSuper, boolean fromInsideClass)
-
Copyright © 2003-2010 The Codehaus. All rights reserved.