Top Description Inners Fields Constructors Methods
org.codehaus.groovy.runtime.metaclass

public final Class ClosureMetaClass

extends MetaClassImpl
Class Inheritance
Imports
groovy.lang.Closure, .ExpandoMetaClass, .GroovyInterceptable, .GroovyObject, .GroovyRuntimeException, .MetaBeanProperty, .MetaClass, .MetaClassImpl, .MetaClassRegistry, .MetaMethod, .MetaProperty, .MissingMethodException, .MissingPropertyException, .ProxyMetaClass, org.codehaus.groovy.reflection.CachedClass, .CachedField, .CachedMethod, .ParameterTypes, org.codehaus.groovy.runtime.InvokerHelper, .MetaClassHelper, org.codehaus.groovy.runtime.callsite.CallSite, .PogoMetaClassSite, org.codehaus.groovy.runtime.wrappers.Wrapper, org.codehaus.groovy.util.FastArray, java.beans.PropertyDescriptor, java.lang.reflect.Constructor, .Method, java.util.ArrayList, .HashMap, .LinkedList, .List, .Map

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!

Since
1.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface
private static class
private static class

Field Summary

Modifier and TypeField and Description
private volatile boolean
private Map<String, CachedField>
private ClosureMetaClass.MethodChooser
private static MetaClassImpl
private static final String
private static final String
private static MetaClassImpl
private final FastArray
private static final Object[]
private volatile boolean
Inherited from groovy.lang.MetaClassImpl:
getPropertyMethodINVOKE_METHOD_METHODinvokeMethodMethodisGroovyObjectisMapmetaMethodIndexMETHOD_MISSINGPROPERTY_MISSINGregistrysetPropertyMethodSTATIC_METHOD_MISSINGSTATIC_PROPERTY_MISSINGtheCachedClasstheClass

Constructor Summary

AccessConstructor and Description
public
ClosureMetaClass(MetaClassRegistry registry, Class<T> theClass)

Method Summary

Modifier and TypeMethod and Description
public void
addMetaBeanProperty(MetaBeanProperty
The MetaBeanProperty
mp
)

Overrides groovy.lang.MetaClassImpl.addMetaBeanProperty.

Implements groovy.lang.MutableMetaClass.addMetaBeanProperty.

Adds a new MetaBeanProperty to this MetaClass
public void
addMetaMethod(MetaMethod
the MetaMethod
method
)

Overrides groovy.lang.MetaClassImpl.addMetaMethod.

Implements groovy.lang.MutableMetaClass.addMetaMethod.

adds a MetaMethod to this class.
public void
addNewInstanceMethod(Method
The method to be added
method
)

Overrides groovy.lang.MetaClassImpl.addNewInstanceMethod.

Implements groovy.lang.MutableMetaClass.addNewInstanceMethod.

Adds an instance method to this metaclass.
public void
addNewStaticMethod(Method
The method to be added
method
)

Overrides groovy.lang.MetaClassImpl.addNewStaticMethod.

Implements groovy.lang.MutableMetaClass.addNewStaticMethod.

Adds a static method to this metaclass.
protected void
private void
public CallSite
public CallSite
public CallSite
createPojoCallSite(CallSite site, Object receiver, Object[] args)

Overrides groovy.lang.MetaClassImpl.createPojoCallSite.

Create a CallSite
public Object
getAttribute(Class<T>
The class of the object that requested the attribute
sender
,
Object
The instance the attribute is to be retrieved from
object
,
String
The name of the attribute
attribute
,
boolean
Whether to look-up on the super class or not
useSuper
,
boolean
Whether the call was invoked from the inside or the outside of the class.
fromInsideClass
)

Overrides groovy.lang.MetaClassImpl.getAttribute.

Retrieves the value of an attribute (field).
private MetaMethod
getDelegateMethod(Closure<V> closure, Object delegate, String methodName, Class<T>[] argClasses)

public List<MetaMethod>
getMetaMethods()

Overrides groovy.lang.MetaClassImpl.getMetaMethods.

Implements groovy.lang.MetaClass.getMetaMethods.

Retrieves the list of MetaMethods held by this class.
public MetaProperty
getMetaProperty(String
The name of the MetaProperty
name
)

Overrides groovy.lang.MetaClassImpl.getMetaProperty.

Implements groovy.lang.MetaObjectProtocol.getMetaProperty.

Returns a MetaProperty for the given name or null if it doesn't exist
public List<MetaMethod>
getMethods()

Overrides groovy.lang.MetaClassImpl.getMethods.

Implements groovy.lang.MetaClass.getMethods.

Retrieves the list of MetaMethods held by the class.
public MetaMethod
getMethodWithoutCaching(int index, Class<T> sender, String methodName, Class<T>[] arguments, boolean isCallToSuper)

public List<MetaProperty>
getProperties()

Overrides groovy.lang.MetaClassImpl.getProperties.

Implements groovy.lang.MetaClass.getProperties.

Get all the properties defined for this type
public Object
getProperty(Class<T>
The java.lang.Class instance that requested the property
sender
,
Object
The Object which the property is being retrieved from
object
,
String
The name of the property
name
,
boolean
Whether the call is to a super class property
useSuper
,
boolean
??
fromInsideClass
)

Overrides groovy.lang.MetaClassImpl.getProperty.

Implements groovy.lang.MetaClass.getProperty.

Retrieves a property on the given receiver for the specified arguments.

private static synchronized MetaClass
public MetaMethod
getStaticMetaMethod(String
The name of the MetaMethod
name
,
Object[]
The argument types
args
)

Overrides groovy.lang.MetaClassImpl.getStaticMetaMethod.

Implements groovy.lang.MetaObjectProtocol.getStaticMetaMethod.

Retrieves a static MetaMethod for the given name and argument values, using the types of the arguments to establish the chosen MetaMethod
public MetaMethod
getStaticMetaMethod(String name, Class<T>[] argTypes)

private synchronized void
public synchronized void
initialize()

Overrides groovy.lang.MetaClassImpl.initialize.

Implements groovy.lang.MetaClass.initialize.

Complete the initialisation process.
public Object
invokeMethod(Class<T>
The java.lang.Class instance that invoked the method
sender
,
Object
The object which the method was invoked on
object
,
String
The name of the method
methodName
,
Object[]
The arguments to the method
originalArguments
,
boolean
Whether the method is a call to a super class method
isCallToSuper
,
boolean
Whether the call was invoked from the inside or the outside of the class
fromInsideClass
)

Overrides groovy.lang.MetaClassImpl.invokeMethod.

Implements groovy.lang.MetaClass.invokeMethod.

Invokes a method on the given receiver for the specified arguments.

private static Object
invokeOnDelegationObjects(boolean invoke1, Object o1, boolean invoke2, Object o2, String methodName, Object[] args)

public Object
invokeStaticMethod(Object
An instance of the class returned by the getTheClass() method or the class itself
object
,
String
The name of the method
methodName
,
Object[]
The arguments to the method
arguments
)

Overrides groovy.lang.MetaClassImpl.invokeStaticMethod.

Implements groovy.lang.MetaObjectProtocol.invokeStaticMethod.

Invokes a static method on the given Object with the given name and arguments.
protected boolean
private static boolean
private synchronized void
private MetaClass
private static Object[]
makeArguments(Object[] arguments, String methodName)

private MetaMethod
pickClosureMethod(Class<T>[] argClasses)

public MetaMethod
pickMethod(String
the name of the method to pick
name
,
Class<T>[]
the method arguments
argTypes
)

Overrides groovy.lang.MetaClassImpl.pickMethod.

Implements groovy.lang.MetaClass.pickMethod.

Selects a method by name and argument classes.
public static void
public List<E>
respondsTo(Object
The object to inspect
obj
,
String
The name of the method of interest
name
,
Object[]
The argument types to match against
argTypes
)

Overrides groovy.lang.MetaClassImpl.respondsTo.

Implements groovy.lang.MetaObjectProtocol.respondsTo.

Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name and arguments types.

public List<E>
respondsTo(final Object
The object to inspect
obj
,
final String
The name of the method of interest
name
)

Overrides groovy.lang.MetaClassImpl.respondsTo.

Implements groovy.lang.MetaObjectProtocol.respondsTo.

Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name regardless of arguments.

public Constructor<T>
public MetaMethod
retrieveStaticMethod(String methodName, Class<T>[] arguments)

public void
setAttribute(Class<T>
The java.lang.Class instance that is mutating the property
sender
,
Object
The Object which the property is being set on
object
,
String
The name of the attribute,
attribute
,
Object
The new value of the attribute to set
newValue
,
boolean
Whether the call is to a super class property
useSuper
,
boolean
Whether the call was invoked from the inside or the outside of the class
fromInsideClass
)

Overrides groovy.lang.MetaClassImpl.setAttribute.

Implements groovy.lang.MetaClass.setAttribute.

Sets an attribute on the given receiver for the specified arguments.

protected void
public void
setProperties(Object bean, Map<K, V> map)

Overrides groovy.lang.MetaClassImpl.setProperties.

Sets a number of bean properties from the given Map where the keys are the String names of properties and the values are the values of the properties to set
public void
setProperty(Class<T>
The java.lang.Class instance that is mutating the property
sender
,
Object
The Object which the property is being set on
object
,
String
The name of the property
name
,
Object
The new value of the property to set
newValue
,
boolean
Whether the call is to a super class property
useSuper
,
boolean
Whether the call was invoked from the inside or the outside of the class.
fromInsideClass
)

Overrides groovy.lang.MetaClassImpl.setProperty.

Implements groovy.lang.MetaClass.setProperty.

Retrieves a property on the given receiver for the specified arguments.

private static void
unwrap(Object[] arguments)

private static Throwable
Inherited from groovy.lang.MetaClassImpl:
addMetaMethodToIndexcheckIfGroovyObjectMethodcheckInitalisedchooseMethodclearInvocationCachescreateConstructorSitecreateErrorMessageForAmbiguitycreateStaticSitecreateTransformMetaMethoddoChooseMostSpecificParamsdropMethodCachedropStaticMethodCachefindMethodInClassHierarchyfindMixinMethodfindOwnMethodfindPropertyInClassHierarchygetAdditionalMetaMethodsgetAttributegetAttributegetClassInfogetClassNodegetEffectiveGetMetaPropertygetMetaMethodgetMethodWithCachinggetMethodWithoutCachinggetPropertygetRegistrygetSubclassMetaMethodsgetSuperClassesgetTheCachedClassgetTheClassgetVersionhandleMatcheshasCustomInvokeMethodhasCustomStaticInvokeMethodhasPropertyincVersioninvokeConstructorinvokeMethodinvokeMethodinvokeMissingMethodinvokeMissingPropertyinvokeStaticMissingPropertyisGroovyObjectisModifiedisPermissivePropertyAccessonGetPropertyFoundInHierarchyonInvokeMethodFoundInHierarchyonMixinMethodFoundonSetPropertyFoundInHierarchyonSuperMethodFoundInHierarchyonSuperPropertyFoundInHierarchyreinitializeretrieveConstructorretrieveStaticMethodselectConstructorAndTransformArgumentssetAttributesetPermissivePropertyAccesssetPropertytoString