[Java] Class ClosureExpression
- org.codehaus.groovy.ast.expr.ClosureExpression
Represents a closure expression such as { statement } or { i -> statement } or { i, x, String y -> statement }
- Authors:
- James Strachan
- Hamlet D'Arcy
Constructor Summary
Constructor and description |
---|
ClosureExpression
(Parameter[] parameters, Statement code) |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
Statement |
getCode() This gets the code statement of the closure. | |
Parameter[] |
getParameters() | |
String |
getText() | |
VariableScope |
getVariableScope() | |
boolean |
isParameterSpecified() | |
void |
setCode(Statement code) This sets the code statement of the closure. | |
void |
setVariableScope(VariableScope variableScope) | |
String |
toString() | |
Expression |
transformExpression(ExpressionTransformer transformer) | |
void |
visit(GroovyCodeVisitor visitor) |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class Expression | getType, setType, transformExpression, transformExpressions, transformExpressions |
class AnnotatedNode | addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic |
class ASTNode | copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getNodeMetaData, getNodeMetaData, getText, putNodeMetaData, removeNodeMetaData, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setNodeMetaData, setSourcePosition, visit |
class Object | wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
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()
@Override public String getText()
public VariableScope getVariableScope()
public boolean isParameterSpecified()
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)
public String toString()
public Expression transformExpression(ExpressionTransformer transformer)
public void visit(GroovyCodeVisitor visitor)
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/2.4.21/html/gapi/org/codehaus/groovy/ast/expr/ClosureExpression.html