ClosureExpression (Groovy 5.0.0)

Package: org.codehaus.groovy.ast.expr

## [Java] Class ClosureExpression

- org.codehaus.groovy.ast.expr.ClosureExpression

-     public class ClosureExpression
      extends Expression

  Represents a closure expression such as

      { statement }

  or { i `->` statement } or { i, x, String y `->` statement }

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class Expression` | `EMPTY_ARRAY`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `ClosureExpression(Parameter[] parameters, Statement code)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public Statement` | `getCode()` This gets the code statement of the closure.
    `` | `public Parameter[]` | `getParameters()` Returns: an array of zero (for implicit it) or more (when explicit args given) parameters or null otherwise (representing explicit no args)
    `` | `public String` | `getText()`
    `` | `public VariableScope` | `getVariableScope()`
    `` | `public boolean` | `isParameterSpecified()` Returns: `true` if one or more explicit parameters are supplied
    `` | `public void` | `setCode(Statement code)` This sets the code statement of the closure.
    `` | `public void` | `setVariableScope(VariableScope variableScope)`
    `` | `public String` | `toString()`
    `` | `public Expression` | `transformExpression(ExpressionTransformer transformer)`
    `` | `public void` | `visit(GroovyCodeVisitor visitor)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Expression` | `getType, setType, transformExpression, transformExpressions, transformExpressions`
    `class AnnotatedNode` | `addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`
    `class ASTNode` | `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit`

- - ### Constructor Detail

    - #### public ClosureExpression(Parameter[] parameters, Statement code)

  - ### Method Detail

    - #### public Statement getCode()

      This gets the code statement of the closure. You can read this method to find out what actions the closure is going to perform.

      Returns:
        the code statement of the closure

    - #### public Parameter[] getParameters()

      Returns:
        an array of zero (for implicit it) or more (when explicit args given) parameters or null otherwise (representing explicit no args)

    - #### @Override
      public String getText()

    - #### public VariableScope getVariableScope()

    - #### public boolean isParameterSpecified()

      Returns:
        `true` if one or more explicit parameters are supplied

    - #### public void setCode(Statement code)

      This sets the code statement of the closure. You can use this method in order to add more actions during the closure execution.

      Parameters:
        `code` - the new Statement

    - #### public void setVariableScope(VariableScope variableScope)

    - #### @Override
      public String toString()

    - #### @Override
      public Expression transformExpression(ExpressionTransformer transformer)

    - #### @Override
      public void visit(GroovyCodeVisitor visitor)