Groovy Documentation

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


Field Summary
 
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
java.lang.Object ClosureMetaClass(MetaClassRegistry registry, java.lang.Class theClass)

void addMetaBeanProperty(MetaBeanProperty mp)

void addMetaMethod(MetaMethod method)

void addNewInstanceMethod(java.lang.reflect.Method method)

void addNewStaticMethod(java.lang.reflect.Method method)

protected void applyPropertyDescriptors(java.beans.PropertyDescriptor[] propertyDescriptors)

CallSite createPogoCallCurrentSite(CallSite site, java.lang.Class sender, java.lang.Object[] args)

CallSite createPogoCallSite(CallSite site, java.lang.Object[] args)

CallSite createPojoCallSite(CallSite site, java.lang.Object receiver, java.lang.Object[] args)

java.lang.Object getAttribute(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, boolean useSuper, boolean fromInsideClass)

java.util.List getMetaMethods()

MetaProperty getMetaProperty(java.lang.String name)

MetaMethod getMethodWithoutCaching(int index, java.lang.Class sender, java.lang.String methodName, java.lang.Class[] arguments, boolean isCallToSuper)

java.util.List getMethods()

java.util.List getProperties()

java.lang.Object getProperty(java.lang.Class sender, java.lang.Object object, java.lang.String name, boolean useSuper, boolean fromInsideClass)

MetaMethod getStaticMetaMethod(java.lang.String name, java.lang.Object[] args)

MetaMethod getStaticMetaMethod(java.lang.String name, java.lang.Class[] argTypes)

void initialize()

java.lang.Object invokeMethod(java.lang.Class sender, java.lang.Object object, java.lang.String methodName, java.lang.Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass)

java.lang.Object invokeStaticMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)

protected boolean isInitialized()

MetaMethod pickMethod(java.lang.String name, java.lang.Class[] argTypes)

java.util.List respondsTo(java.lang.Object obj, java.lang.String name, java.lang.Object[] argTypes)

java.util.List respondsTo(java.lang.Object obj, java.lang.String name)

java.lang.reflect.Constructor retrieveConstructor(java.lang.Class[] arguments)

MetaMethod retrieveStaticMethod(java.lang.String methodName, java.lang.Class[] arguments)

void setAttribute(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, java.lang.Object newValue, boolean useSuper, boolean fromInsideClass)

void setProperties(java.lang.Object bean, java.util.Map map)

void setProperty(java.lang.Class sender, java.lang.Object object, java.lang.String name, java.lang.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, getRegistry, getStaticMetaMethod, getSubclassMetaMethods, getSuperClasses, getTheCachedClass, getTheClass, getVersion, hasProperty, incVersion, initialize, invokeConstructor, invokeMethod, invokeMethod, invokeMethod, invokeMissingMethod, invokeMissingProperty, invokeStaticMethod, invokeStaticMissingProperty, isGroovyObject, isInitialized, isModified, onGetPropertyFoundInHierarchy, onInvokeMethodFoundInHierarchy, onMixinMethodFound, onSetPropertyFoundInHierarchy, onSuperMethodFoundInHierarchy, onSuperPropertyFoundInHierarchy, pickMethod, respondsTo, respondsTo, retrieveConstructor, retrieveStaticMethod, selectConstructorAndTransformArguments, setAttribute, setAttribute, setProperties, setProperty, setProperty, toString
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Method Detail

ClosureMetaClass

public java.lang.Object ClosureMetaClass(MetaClassRegistry registry, java.lang.Class theClass)


addMetaBeanProperty

public void addMetaBeanProperty(MetaBeanProperty mp)


addMetaMethod

public void addMetaMethod(MetaMethod method)


addNewInstanceMethod

public void addNewInstanceMethod(java.lang.reflect.Method method)


addNewStaticMethod

public void addNewStaticMethod(java.lang.reflect.Method method)


applyPropertyDescriptors

protected void applyPropertyDescriptors(java.beans.PropertyDescriptor[] propertyDescriptors)


createPogoCallCurrentSite

public CallSite createPogoCallCurrentSite(CallSite site, java.lang.Class sender, java.lang.Object[] args)


createPogoCallSite

public CallSite createPogoCallSite(CallSite site, java.lang.Object[] args)


createPojoCallSite

public CallSite createPojoCallSite(CallSite site, java.lang.Object receiver, java.lang.Object[] args)


getAttribute

if (mfp == null) {
public java.lang.Object getAttribute(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, boolean useSuper, boolean fromInsideClass)


getMetaMethods

protected boolean isInitialized() {
public java.util.List getMetaMethods()


getMetaProperty

public MetaProperty getMetaProperty(java.lang.String name)


getMethodWithoutCaching

public MetaMethod getMethodWithoutCaching(int index, java.lang.Class sender, java.lang.String methodName, java.lang.Class[] arguments, boolean isCallToSuper)


getMethods

return CLOSURE_METACLASS.getMetaMethod(name, argTypes);
public java.util.List getMethods()


getProperties

return CLOSURE_METACLASS.getStaticMetaMethod(name, args);
public java.util.List getProperties()


getProperty

public java.lang.Object getProperty(java.lang.Class sender, java.lang.Object object, java.lang.String name, boolean useSuper, boolean fromInsideClass)


getStaticMetaMethod

public MetaMethod getStaticMetaMethod(java.lang.String name, java.lang.Object[] args)


getStaticMetaMethod

public MetaMethod getStaticMetaMethod(java.lang.String name, java.lang.Class[] argTypes)


initialize

public void initialize()


invokeMethod

public java.lang.Object invokeMethod(java.lang.Class sender, java.lang.Object object, java.lang.String methodName, java.lang.Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass)


invokeStaticMethod

public java.lang.Object invokeStaticMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)


isInitialized

protected boolean isInitialized()


pickMethod

}
public MetaMethod pickMethod(java.lang.String name, java.lang.Class[] argTypes)


respondsTo

public java.util.List respondsTo(java.lang.Object obj, java.lang.String name, java.lang.Object[] argTypes)


respondsTo

public java.util.List respondsTo(java.lang.Object obj, java.lang.String name)


retrieveConstructor

public java.lang.reflect.Constructor retrieveConstructor(java.lang.Class[] arguments)


retrieveStaticMethod

public MetaMethod retrieveStaticMethod(java.lang.String methodName, java.lang.Class[] arguments)


setAttribute

} else {
public void setAttribute(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, java.lang.Object newValue, boolean useSuper, boolean fromInsideClass)


setProperties

public void setProperties(java.lang.Object bean, java.util.Map map)


setProperty

public void setProperty(java.lang.Class sender, java.lang.Object object, java.lang.String name, java.lang.Object newValue, boolean useSuper, boolean fromInsideClass)


 

Groovy Documentation