Package org.apache.groovy.util

# Class Closures.FunctionClosure<T,R>

java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.Closure<R>
org.apache.groovy.util.Closures.FunctionClosure<T,R>

All Implemented Interfaces:
  `GroovyCallable<R>`, `GroovyObject`, `Serializable`, `Cloneable`, `Runnable`, `Callable<R>`, `Function<T,R>`

Enclosing class:
  Closures

public static class Closures.FunctionClosure<T,R> extends Closure<R> implements Function<T,R>
Hybrid one-argument function that is both a `Closure` and a `Function`.

Since:
  6.0.0
See Also:
  - Serialized Form

- ## Field Summary

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

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Object[]`
  `additionalReferences()`
  Exposes the wrapped Function, which the call methods dispatch to but which is held outside the `owner`/`delegate`/`thisObject` references the cycle check walks by default.
  `R`
  `apply(T t)`
  `R`
  `call(Object arg)`
  Invokes the closure with given argument(s), returning any value if applicable.
  `R`
  `call(Object... args)`
  Invokes the closure with given argument(s), returning any value if applicable.

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

  `andThen, andThenSelf, andThenSelf, asWritable, call, checkForReferenceCycle, clone, compose, composeSelf, composeSelf, curry, curry, dehydrate, getDelegate, getDirective, getMaximumNumberOfParameters, getOwner, getParameterTypes, getProperty, getResolveStrategy, getThisObject, isCase, leftShift, leftShift, memoize, memoizeAtLeast, memoizeAtMost, memoizeBetween, mopUnperturbed, ncurry, ncurry, rcurry, rcurry, rehydrate, rightShift, run, setDelegate, setDirective, setMetaClass, setProperty, setResolveStrategy, throwRuntimeException, trampoline, trampoline`

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

  `getMetaClass`

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

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

  ### Methods inherited from interface java.util.function.Function

  `andThen, compose`

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

  `invokeMethod`

- ## Method Details

  - ### apply

    public R apply(T t)
    Specified by:
      `apply` in interface `Function<T,R>`

  - ### call

    public R call(Object arg)
    Description copied from class: `Closure`
    Invokes the closure with given argument(s), returning any value if applicable.
    Overrides:
      `call` in class `Closure<R>`
    Parameters:
      `arg` - could be a single value or a List of values
    Returns:
      The value if applicable or null if there is no return statement in the closure.

  - ### call

    public R call(Object... args)
    Description copied from class: `Closure`
    Invokes the closure with given argument(s), returning any value if applicable.
    Overrides:
      `call` in class `Closure<R>`
    Returns:
      The value if applicable or null if there is no return statement in the closure.

  - ### additionalReferences

    protected Object[] additionalReferences()
    Exposes the wrapped Function, which the call methods dispatch to but which is held outside the `owner`/`delegate`/`thisObject` references the cycle check walks by default. Only `Closure`-valued links are followed, so a plain Function contributes nothing.
    Overrides:
      `additionalReferences` in class `Closure<R>`
    Returns:
      the additional closures reached when this one is invoked; never `null`