MethodClosure (Groovy 5.0.7)
Description: declaration: package: org.codehaus.groovy.runtime, class: MethodClosure

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`

public class MethodClosure extends Closure
Represents a method on an object using a closure, which can be invoked at any time.

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static boolean`
  `ALLOW_RESOLVE`
  `static final String`
  `ANY_INSTANCE_METHOD_EXISTS`
  `static final String`
  `NEW`

  ### Fields inherited from class groovy.lang.Closure

  `DELEGATE_FIRST, DELEGATE_ONLY, DONE, IDENTITY, maximumNumberOfParameters, OWNER_FIRST, OWNER_ONLY, parameterTypes, SKIP, TO_SELF`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MethodClosure(Object owner, String method)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Object`
  `doCall(Object arguments)`
  `String`
  `getMethod()`
  `Object`
  `getOwner()`
  `Class<?>`
  `getOwnerClass()`
  `Object`
  `getProperty(String property)`
  Retrieves a property value.

  ### Methods inherited from class groovy.lang.Closure

  `andThen, andThenSelf, andThenSelf, asWritable, call, call, call, 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, trampoline`

  ### Methods inherited from class groovy.lang.GroovyObjectSupport

  `getMetaClass, setMetaClass`

  ### Methods inherited from class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface groovy.lang.GroovyObject

  `invokeMethod`

- ## Field Details

  - ### ALLOW_RESOLVE

    public static boolean ALLOW_RESOLVE

  - ### ANY_INSTANCE_METHOD_EXISTS

    public static final String ANY_INSTANCE_METHOD_EXISTS
    See Also:
      - Constant Field Values

  - ### NEW

    public static final String NEW
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### MethodClosure

    public MethodClosure(Object owner, String method)

- ## Method Details

  - ### getMethod

    public String getMethod()

  - ### getOwner

    public Object getOwner()
    Overrides:
      `getOwner` in class `Closure`
    Returns:
      the owner Object to which method calls will go which is typically the outer class when the closure is constructed

  - ### getOwnerClass

    public Class<?> getOwnerClass()
    Since:
      5.0.0

  - ### getProperty

    public Object getProperty(String property)
    Description copied from interface: `GroovyObject`
    Retrieves a property value.
    Specified by:
      `getProperty` in interface `GroovyObject`
    Overrides:
      `getProperty` in class `Closure`
    Parameters:
      `property` - the name of the property of interest
    Returns:
      the given property

  - ### doCall

    protected Object doCall(Object arguments)