## groovy.lang
Class Closure

Field Summary
`int` | `DELEGATE_FIRST`
`int` | `DELEGATE_ONLY`
`int` | `DONE`
`def` | `EMPTY_OBJECT_ARRAY`
`int` | `OWNER_FIRST`
`int` | `OWNER_ONLY`
`int` | `SKIP`
`int` | `TO_SELF`
`Object` | `delegate`
`int` | `directive`
`int` | `maximumNumberOfParameters`
`Object` | `owner`
`def` | `parameterTypes`
`int` | `resolveStrategy`
`Object` | `thisObject`

Constructor Summary
`Closure(Object owner, Object thisObject)`
`Closure(Object owner)`

Method Summary
`Closure` | `asWritable()`
`Object` | `call()` Invokes the closure without any parameters, returning any value if applicable.
`Object` | `call(def args)`
`Object` | `call(Object arguments)` Invokes the closure, returning any value if applicable.
`Object` | `clone()`
`Closure` | `curry(def arguments)` Support for closure currying
`Object` | `getDelegate()` typically the outer class when the closure is constructed
`int` | `getMaximumNumberOfParameters()` of this closure can take
`Object` | `getOwner()` typically the outer class when the closure is constructed
`def` | `getParameterTypes()` of this closure
`Object` | `getProperty(String property)`
`Object` | `getPropertyDelegateFirst(String property)`
`Object` | `getPropertyOwnerFirst(String property)`
`Object` | `getPropertyTryThese(String property, Object firstTry, Object secondTry)`
`int` | `getResolveStrategy()` Gets the strategy which the closure users to resolve methods and properties
`Object` | `getThisObject()`
`boolean` | `isCase(Object candidate)`
`void` | `run()`
`void` | `setDelegate(Object delegate)` Allows the delegate to be changed such as when performing markup building
`void` | `setProperty(String property, Object newValue)`
`void` | `setPropertyDelegateFirst(String property, Object newValue)`
`void` | `setPropertyOwnerFirst(String property, Object newValue)`
`void` | `setPropertyTryThese(String property, Object newValue, Object firstTry, Object secondTry)`
`void` | `setResolveStrategy(int resolveStrategy)` Sets the strategy which the closure uses to resolve property references.
`static Object` | `throwRuntimeException(Throwable throwable)`

Constructor Detail

### Closure

    public Closure(Object owner, Object thisObject)

### Closure

    public Closure(Object owner)

Method Detail

### asWritable

    public Closure asWritable()

  return:
    a version of this closure which implements Writable

### call

    public Object call()

  Invokes the closure without any parameters, returning any value if applicable.
  return:
    the value if applicable or null if there is no return statement in the closure

### call

    public Object call(def args)

### call

    public Object call(Object arguments)

  Invokes the closure, returning any value if applicable.
  param:
    arguments could be a single value or a List of values
  return:
    the value if applicable or null if there is no return statement in the closure

### clone

    public Object clone()

### curry

    public Closure curry(def arguments)

  Support for closure currying
  param:
    arguments the arguments to bind
  return:
    the new closure with its arguments bound

### getDelegate

    public Object getDelegate()

  return:
    the delegate Object to which method calls will go which is
  typically the outer class when the closure is constructed

### getMaximumNumberOfParameters

    public int getMaximumNumberOfParameters()

  return:
    the maximum number of parameters a doCall methos
  of this closure can take

### getOwner

    public Object getOwner()

  return:
    the owner Object to which method calls will go which is
  typically the outer class when the closure is constructed

### getParameterTypes

    public def getParameterTypes()

  return:
    the parameter types of the longest doCall method
  of this closure

### getProperty

    public Object getProperty(String property)

### getPropertyDelegateFirst

    Object getPropertyDelegateFirst(String property)

### getPropertyOwnerFirst

    Object getPropertyOwnerFirst(String property)

### getPropertyTryThese

    Object getPropertyTryThese(String property, Object firstTry, Object secondTry)

### getResolveStrategy

    public int getResolveStrategy()

  Gets the strategy which the closure users to resolve methods and properties
  return:
    The resolve strategy
  see:
    Closure#DELEGATE_FIRST
  see:
    Closure#DELEGATE_ONLY
  see:
    Closure#OWNER_FIRST
  see:
    Closure#OWNER_ONLY
  see:
    Closure#TO_SELF

### getThisObject

    public Object getThisObject()

### isCase

    public boolean isCase(Object candidate)

### run

    public void run()

### setDelegate

    public void setDelegate(Object delegate)

  Allows the delegate to be changed such as when performing markup building
  param:
    delegate the new delegate

### setProperty

    public void setProperty(String property, Object newValue)

### setPropertyDelegateFirst

    void setPropertyDelegateFirst(String property, Object newValue)

### setPropertyOwnerFirst

    void setPropertyOwnerFirst(String property, Object newValue)

### setPropertyTryThese

    void setPropertyTryThese(String property, Object newValue, Object firstTry, Object secondTry)

### setResolveStrategy

    public void setResolveStrategy(int resolveStrategy)

  Sets the strategy which the closure uses to resolve property references. The default is Closure.OWNER_FIRST
  param:
    resolveStrategy The resolve strategy to set
  see:
    Closure#DELEGATE_FIRST
  see:
    Closure#DELEGATE_ONLY
  see:
    Closure#OWNER_FIRST
  see:
    Closure#OWNER_ONLY
  see:
    Closure#TO_SELF

### throwRuntimeException

    static Object throwRuntimeException(Throwable throwable)