Package org.codehaus.groovy.runtime
Class MethodClosure
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.Closure
org.codehaus.groovy.runtime.MethodClosure
- All Implemented Interfaces:
GroovyCallable,GroovyObject,Serializable,Cloneable,Runnable,Callable
Represents a method on an object using a closure, which can be invoked at any
time.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic booleanEnables flexible object serialization behavior for MethodClosure instances.static final StringProperty name indicating whether an instance method exists for this method closure.static final StringMethod name constant for constructor invocations.Fields inherited from class groovy.lang.Closure
DELEGATE_FIRST, DELEGATE_ONLY, DONE, IDENTITY, maximumNumberOfParameters, OWNER_FIRST, OWNER_ONLY, parameterTypes, SKIP, TO_SELF -
Constructor Summary
ConstructorsConstructorDescriptionMethodClosure(Object owner, String method) Constructs a MethodClosure wrapping a method of the given owner object. -
Method Summary
Methods inherited from class groovy.lang.Closure
andThen, andThenSelf, andThenSelf, asWritable, call, call, call, checkForReferenceCycle, clone, compose, composeSelf, composeSelf, curry, curry, dehydrate, getDelegate, getDirective, getMaximumNumberOfParameters, getParameterTypes, getResolveStrategy, getThisObject, isCase, leftShift, leftShift, memoize, memoizeAtLeast, memoizeAtMost, memoizeBetween, ncurry, ncurry, rcurry, rcurry, rehydrate, rightShift, run, setDelegate, setDirective, setProperty, setResolveStrategy, throwRuntimeException, trampoline, trampolineMethods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClassMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface groovy.lang.GroovyObject
invokeMethod
-
Field Details
-
ALLOW_RESOLVE
public static boolean ALLOW_RESOLVEEnables flexible object serialization behavior for MethodClosure instances. -
ANY_INSTANCE_METHOD_EXISTS
Property name indicating whether an instance method exists for this method closure.- See Also:
-
NEW
Method name constant for constructor invocations.- See Also:
-
-
Constructor Details
-
MethodClosure
Constructs a MethodClosure wrapping a method of the given owner object.- Parameters:
owner- the object on which the method is invoked, or a Class for static methodsmethod- the name of the method to wrap, or "new" for constructor invocations
-
-
Method Details
-
getMethod
-
getOwner
-
getOwnerClass
Returns the class of the owner object, unwrapping it if it's a Wrapper. If the owner is a Class, returns that Class; otherwise, returns the class of the owner.- Returns:
- the class of the owner object
- Since:
- 5.0.0
-
getProperty
Description copied from class:ClosureRetrieves a property value.- Specified by:
getPropertyin interfaceGroovyObject- Overrides:
getPropertyin classClosure- Parameters:
property- the name of the property of interest- Returns:
- the given property
-
doCall
-