Package: groovy.lang

## [Java] Class Closure

- groovy.lang.Closure

-     public class Closure
      extends Object

  GDK enhancements for Closure.

  displayName:
    Closure
  receiverFqcn:
    groovy.lang.Closure

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `<T>` | `public T` | `asType(Class<T> type)` Coerces the closure to an implementation of the given class.
    `` | `public boolean` | `isNotCase(Object switchValue)` Since: 4.0.0
    `` | `public void` | `print(Object value)` Print a value to the standard output stream.
    `` | `public void` | `printf(String format, Object[] values)` Printf 0 or more values to the standard output stream using a format string.
    `` | `public void` | `printf(String format, Object value)` Printf a value to the standard output stream using a format string.
    `` | `public void` | `println()` Print a linebreak to the standard output stream.
    `` | `public void` | `println(Object value)` Print a value (followed by a newline) to the standard output stream.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `addShutdownHook, any, any, asBoolean, asType, clamp, clamp, collect, collect, collect, dump, each, eachMatch, eachMatch, eachWithIndex, every, every, find, find, findAll, findAll, findIndexOf, findIndexOf, findIndexValues, findIndexValues, findLastIndexOf, findLastIndexOf, findResult, findResult, findResult, findResult, getAt, getMetaClass, getMetaPropertyValues, getProperties, grep, grep, hasProperty, identity, inject, inject, inspect, invokeMethod, is, isCase, isNotCase, iterator, metaClass, print, print, printf, printf, println, println, println, putAt, respondsTo, respondsTo, setMetaClass, sleep, sleep, split, sprintf, sprintf, stream, takeIf, tap, toString, use, use, use, with, with, withCloseable, withCloseable, withMethodClosure, withStream, withStream, withTraits`

- - ### Method Detail

    - #### <T> public T asType(Class<T> type)

      Coerces the closure to an implementation of the given class. The class is assumed to be an interface or class with a single method definition. The closure is used as the implementation of that single method.

      Parameters:
        `type` - the target type
      Returns:
        A proxy of the given type which wraps this closure.
      Since:
        1.0

    - #### public boolean isNotCase(Object switchValue)

      Since:
        4.0.0

    - #### public void print(Object value)

      Print a value to the standard output stream. This method delegates to the owner to execute the method.

      Parameters:
        `value` - the value to print
      Since:
        1.0

    - #### public void printf(String format, Object[] values)

      Printf 0 or more values to the standard output stream using a format string. This method delegates to the owner to execute the method.

      Parameters:
        `format` - a format string
        `values` - values referenced by the format specifiers in the format string
      Since:
        3.0.0

    - #### public void printf(String format, Object value)

      Printf a value to the standard output stream using a format string. This method delegates to the owner to execute the method.

      Parameters:
        `format` - a format string
        `value` - value referenced by the format specifier in the format string
      Since:
        3.0.0

    - #### public void println()

      Print a linebreak to the standard output stream. This method delegates to the owner to execute the method.

      Since:
        1.0

    - #### public void println(Object value)

      Print a value (followed by a newline) to the standard output stream. This method delegates to the owner to execute the method.

      Parameters:
        `value` - the value to print
      Since:
        1.0