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

public Class ClosureMetaMethod

extends MetaMethod
implements ClosureInvokingMethod
Class Inheritance
All Implemented Interfaces
groovy.lang.ClosureInvokingMethod
Known Direct Subclasses
org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.MethodClosureMetaMethod
Imports
groovy.lang.Closure, .ClosureInvokingMethod, .MetaMethod, org.codehaus.groovy.reflection.CachedClass, .CachedMethod, .ReflectionCache, org.codehaus.groovy.runtime.GeneratedClosure, .InvokerHelper, .MethodClosure, java.lang.reflect.Modifier, java.util.ArrayList, .List

A MetaMethod that accepts a closure in the constructor which is invoked when the MetaMethod is called. The delegate of the closure is set to the instance that the MetaMethod is invoked on when called.
Since
1.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private static class

Field Summary

Modifier and TypeField and Description
private final Closure<V>
private final CachedClass
private final CachedMethod
private static final Class<T>[]
private final String
Inherited from groovy.lang.MetaMethod:
EMPTY_ARRAY

Constructor Summary

AccessConstructor and Description
public
public
ClosureMetaMethod(String name, Class<T> declaringClass, Closure<V> c, CachedMethod doCall)

Method Summary

Modifier and TypeMethod and Description
private static MetaMethod
public static ClosureMetaMethod
copy(ClosureMetaMethod closureMethod)

public static List<MetaMethod>
createMethodList(final String name, final Class<T> declaringClass, final Closure<V> closure)

public Closure<V>

Returns:

The closure
getClosure
()

Implements groovy.lang.ClosureInvokingMethod.getClosure.

Retrieves the closure that is invoked by this MetaMethod
public CachedClass
getDeclaringClass()

Implements abstract groovy.lang.MetaMethod.getDeclaringClass.

Gets the class where this method is declared
public CachedMethod
public int
getModifiers()

Implements abstract groovy.lang.MetaMethod.getModifiers.

Returns the modifiers for this method
public String
getName()

Implements abstract groovy.lang.MetaMethod.getName.

Implements groovy.lang.ClosureInvokingMethod.getName.

The method name
public Class<T>
getReturnType()

Implements abstract groovy.lang.MetaMethod.getReturnType.

Access the return type for this method
public Object
invoke(final Object
The object this method should be invoked on
object
,
Object[]
The arguments for the method if applicable
arguments
)

Implements abstract groovy.lang.MetaMethod.invoke.

Invoke this method
Inherited from groovy.lang.MetaMethod:
checkParametersclonedoMethodInvokeequalequalgetDescriptorgetMopNamegetSignatureisAbstractisCacheableisMethodisPrivateisProtectedisPublicisSameisStaticprocessDoMethodInvokeExceptiontoString

Field Detail

callableback to summary
private final Closure<V> callable
declaringClassback to summary
private final CachedClass declaringClass
doCallback to summary
private final CachedMethod doCall
EMPTY_CLASS_ARRAYback to summary
private static final Class<T>[] EMPTY_CLASS_ARRAY
nameback to summary
private final String name

Constructor Detail

ClosureMetaMethodback to summary
public ClosureMetaMethod(String name, Closure<V> c, CachedMethod doCall)
ClosureMetaMethodback to summary
public ClosureMetaMethod(String name, Class<T> declaringClass, Closure<V> c, CachedMethod doCall)

Method Detail

adjustParamTypesForStdMethodsback to summary
private static MetaMethod adjustParamTypesForStdMethods(MetaMethod metaMethod, String methodName)
copyback to summary
public static ClosureMetaMethod copy(ClosureMetaMethod closureMethod)
createMethodListback to summary
public static List<MetaMethod> createMethodList(final String name, final Class<T> declaringClass, final Closure<V> closure)
getClosureback to summary
public Closure<V> getClosure()

Implements groovy.lang.ClosureInvokingMethod.getClosure.

Retrieves the closure that is invoked by this MetaMethod

Returns:Closure<V>

The closure

getDeclaringClassback to summary
public CachedClass getDeclaringClass()

Implements abstract groovy.lang.MetaMethod.getDeclaringClass.

Doc from groovy.lang.MetaMethod.getDeclaringClass.

Gets the class where this method is declared

Returns:CachedClass

class of this method

getDoCallback to summary
public CachedMethod getDoCall()
getModifiersback to summary
public int getModifiers()

Implements abstract groovy.lang.MetaMethod.getModifiers.

Doc from groovy.lang.MetaMethod.getModifiers.

Returns the modifiers for this method

Returns:int

modifiers as an int.

getNameback to summary
public String getName()

Implements abstract groovy.lang.MetaMethod.getName.

Implements groovy.lang.ClosureInvokingMethod.getName.

Doc from groovy.lang.ClosureInvokingMethod.getName.

The method name

Returns:String

The method name

getReturnTypeback to summary
public Class<T> getReturnType()

Implements abstract groovy.lang.MetaMethod.getReturnType.

Doc from groovy.lang.MetaMethod.getReturnType.

Access the return type for this method

Returns:Class<T>

the return type of this method

invokeback to summary
public Object invoke(final Object object, Object[] arguments)

Implements abstract groovy.lang.MetaMethod.invoke.

Doc from groovy.lang.MetaMethod.invoke.

Invoke this method

Parameters
object:Object

The object this method should be invoked on

arguments:Object[]

The arguments for the method if applicable

Returns:Object

The return value of the invocation

org.codehaus.groovy.runtime.metaclass back to summary

pack-priv Class ClosureMetaMethod.AnonymousMetaMethod

extends MetaMethod
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Closure<V>
private final Class<T>
private final String
Inherited from groovy.lang.MetaMethod:
EMPTY_ARRAY

Constructor Summary

AccessConstructor and Description
public
AnonymousMetaMethod(Closure<V> closure, String name, Class<T> declaringClass)

Method Summary

Modifier and TypeMethod and Description
public CachedClass
getDeclaringClass()

Implements abstract groovy.lang.MetaMethod.getDeclaringClass.

Gets the class where this method is declared
public int
getModifiers()

Implements abstract groovy.lang.MetaMethod.getModifiers.

Returns the modifiers for this method
public String
getName()

Implements abstract groovy.lang.MetaMethod.getName.

Returns the name of the method represented by this class
public Class<T>
getReturnType()

Implements abstract groovy.lang.MetaMethod.getReturnType.

Access the return type for this method
public Object
invoke(Object
The object this method should be invoked on
object
,
Object[]
The arguments for the method if applicable
arguments
)

Implements abstract groovy.lang.MetaMethod.invoke.

Invoke this method
Inherited from groovy.lang.MetaMethod:
checkParametersclonedoMethodInvokeequalequalgetDescriptorgetMopNamegetSignatureisAbstractisCacheableisMethodisPrivateisProtectedisPublicisSameisStaticprocessDoMethodInvokeExceptiontoString

Field Detail

closureback to summary
private final Closure<V> closure
declaringClassback to summary
private final Class<T> declaringClass
nameback to summary
private final String name

Constructor Detail

AnonymousMetaMethodback to summary
public AnonymousMetaMethod(Closure<V> closure, String name, Class<T> declaringClass)

Method Detail

getDeclaringClassback to summary
public CachedClass getDeclaringClass()

Implements abstract groovy.lang.MetaMethod.getDeclaringClass.

Doc from groovy.lang.MetaMethod.getDeclaringClass.

Gets the class where this method is declared

Returns:CachedClass

class of this method

getModifiersback to summary
public int getModifiers()

Implements abstract groovy.lang.MetaMethod.getModifiers.

Doc from groovy.lang.MetaMethod.getModifiers.

Returns the modifiers for this method

Returns:int

modifiers as an int.

getNameback to summary
public String getName()

Implements abstract groovy.lang.MetaMethod.getName.

Doc from groovy.lang.MetaMethod.getName.

Returns the name of the method represented by this class

Returns:String

name of this method

getReturnTypeback to summary
public Class<T> getReturnType()

Implements abstract groovy.lang.MetaMethod.getReturnType.

Doc from groovy.lang.MetaMethod.getReturnType.

Access the return type for this method

Returns:Class<T>

the return type of this method

invokeback to summary
public Object invoke(Object object, Object[] arguments)

Implements abstract groovy.lang.MetaMethod.invoke.

Doc from groovy.lang.MetaMethod.invoke.

Invoke this method

Parameters
object:Object

The object this method should be invoked on

arguments:Object[]

The arguments for the method if applicable

Returns:Object

The return value of the invocation

org.codehaus.groovy.runtime.metaclass back to summary

private Class ClosureMetaMethod.MethodClosureMetaMethod

extends ClosureMetaMethod
Class Inheritance

Constructor Summary

AccessConstructor and Description
public
MethodClosureMetaMethod(String name, Class<T> declaringClass, Closure<V> closure, CachedMethod method)

Method Summary

Modifier and TypeMethod and Description
public Object
invoke(Object
The object this method should be invoked on
object
,
Object[]
The arguments for the method if applicable
arguments
)

Overrides org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke.

Invoke this method
Inherited from org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod:
copycreateMethodListgetClosuregetDeclaringClassgetDoCallgetModifiersgetNamegetReturnType

Constructor Detail

MethodClosureMetaMethodback to summary
public MethodClosureMetaMethod(String name, Class<T> declaringClass, Closure<V> closure, CachedMethod method)

Method Detail

invokeback to summary
public Object invoke(Object object, Object[] arguments)

Overrides org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke.

Doc from groovy.lang.MetaMethod.invoke.

Invoke this method

Parameters
object:Object

The object this method should be invoked on

arguments:Object[]

The arguments for the method if applicable

Returns:Object

The return value of the invocation