Class ClosureStaticMetaMethod
java.lang.Object
org.codehaus.groovy.reflection.ParameterTypes
groovy.lang.MetaMethod
org.codehaus.groovy.runtime.metaclass.ClosureStaticMetaMethod
- All Implemented Interfaces:
ClosureInvokingMethod,MetaMember,Cloneable
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
Fields inherited from class groovy.lang.MetaMethod
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionClosureStaticMetaMethod(String name, Class declaringClass, Closure c) ClosureStaticMetaMethod(String name, Class declaringClass, Closure c, Class[] paramTypes) Constructs a new ClosureStaticMetaMethod with the specified parameter types. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the closure that is invoked by this MetaMethodReturns the cached class that declares this meta method.intReturns the modifiers for this meta method (PUBLIC | STATIC).getName()Returns the name of this static meta method.Returns the return type of this method.Invokes the static closure method with the given arguments.Methods inherited from class groovy.lang.MetaMethod
checkParameters, clone, doMethodInvoke, equal, equal, getDescriptor, getMopName, getSignature, isAbstract, isCacheable, isDefault, isMethod, isSame, processDoMethodInvokeException, toStringMethods inherited from class org.codehaus.groovy.reflection.ParameterTypes
coerceArgumentsToClasses, correctArguments, getNativeParameterTypes, getParameterTypes, getPT, isValidExactMethod, isValidExactMethod, isValidMethod, isValidMethod, isVargsMethod, isVargsMethod, setParametersTypesMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface groovy.lang.MetaMember
isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isSynthetic
-
Constructor Details
-
ClosureStaticMetaMethod
- Parameters:
name- The name of the MetaMethoddeclaringClass- The class which declared the MetaMethodc- The closure that this ClosureMetaMethod will invoke when called
-
ClosureStaticMetaMethod
Constructs a new ClosureStaticMetaMethod with the specified parameter types.- Parameters:
name- The name of the MetaMethoddeclaringClass- The class which declared the MetaMethodc- The closure that this ClosureStaticMetaMethod will invoke when calledparamTypes- The parameter types for the closure method
-
-
Method Details
-
invoke
Invokes the static closure method with the given arguments. The closure's delegate is set to the object parameter.- Specified by:
invokein classMetaMethod- Parameters:
object- the object to set as the closure's delegatearguments- the arguments to pass to the closure- Returns:
- the result of the closure invocation
-
getModifiers
public int getModifiers()Returns the modifiers for this meta method (PUBLIC | STATIC).- Specified by:
getModifiersin interfaceMetaMember- Specified by:
getModifiersin classMetaMethod- Returns:
- the modifiers indicating this is a public static method
-
getName
Returns the name of this static meta method.- Specified by:
getNamein interfaceMetaMember- Specified by:
getNamein classMetaMethod- Returns:
- the name of the method
-
getReturnType
Returns the return type of this method.- Specified by:
getReturnTypein classMetaMethod- Returns:
- Object.class, as closures return Object
-
getDeclaringClass
Returns the cached class that declares this meta method.- Specified by:
getDeclaringClassin classMetaMethod- Returns:
- the declaring class
-
getClosure
Retrieves the closure that is invoked by this MetaMethod- Specified by:
getClosurein interfaceClosureInvokingMethod- Returns:
- The closure
-