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

public Class ClosureStaticMetaMethod

extends MetaMethod
implements ClosureInvokingMethod
Class Inheritance
All Implemented Interfaces
groovy.lang.ClosureInvokingMethod
Imports
groovy.lang.Closure, .ClosureInvokingMethod, .MetaMethod, org.codehaus.groovy.reflection.CachedClass, .ReflectionCache, java.lang.reflect.Modifier

This class represents a MetaMethod that is a closure that pretends to be a static method. It is used by ExpandoMetaClass to allow addition of static methods defined as closures
Since
01.1

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
ClosureStaticMetaMethod(String
The name of the MetaMethod
name
,
Class<T>
The class which declared the MetaMethod
declaringClass
,
Closure<V>
The closure that this ClosureMetaMethod will invoke when called
c
)

public
ClosureStaticMetaMethod(String name, Class<T> declaringClass, Closure<V> c, Class<T>[] paramTypes)

Method Summary

Modifier and TypeMethod and Description
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 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(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
nameback to summary
private final String name

Constructor Detail

ClosureStaticMetaMethodback to summary
public ClosureStaticMetaMethod(String name, Class<T> declaringClass, Closure<V> c)
Parameters
name:String

The name of the MetaMethod

declaringClass:Class<T>

The class which declared the MetaMethod

c:Closure<V>

The closure that this ClosureMetaMethod will invoke when called

ClosureStaticMetaMethodback to summary
public ClosureStaticMetaMethod(String name, Class<T> declaringClass, Closure<V> c, Class<T>[] paramTypes)

Method Detail

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

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(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