public class TupleExpression
extends Expression
implements Iterable
Represents a tuple or grouped list of expressions, typically used for method arguments, multiple assignment targets, or other contexts requiring multiple values. A tuple expression is a simple container for an ordered list of Expression objects and implements Iterable for convenient traversal.
| Fields inherited from class | Fields |
|---|---|
class Expression |
EMPTY_ARRAY |
| Constructor and description |
|---|
TupleExpression()Creates an empty tuple expression with zero initial capacity. |
TupleExpression(Expression expr)Creates a tuple expression containing a single expression. |
TupleExpression(Expression expr1, Expression expr2)Creates a tuple expression containing two expressions. |
TupleExpression(Expression expr1, Expression expr2, Expression expr3)Creates a tuple expression containing three expressions. |
TupleExpression(int capacity)Creates a tuple expression with pre-allocated capacity. |
TupleExpression(List<Expression> expressions)Creates a tuple expression from an existing list of expressions. |
TupleExpression(Expression[] expressionArray)Creates a tuple expression from an array of expressions. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public TupleExpression |
addExpression(Expression expression)Adds an expression to this tuple. |
|
public Expression |
getExpression(int i)Returns the expression at the specified index. |
|
public List<Expression> |
getExpressions()Returns the list of all expressions in this tuple. |
|
public String |
getText() |
|
public Iterator<Expression> |
iterator()Returns an unmodifiable iterator over the expressions in this tuple. |
|
public String |
toString() |
|
public Expression |
transformExpression(ExpressionTransformer transformer) |
|
public void |
visit(GroovyCodeVisitor visitor) |
| 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 |
Creates an empty tuple expression with zero initial capacity.
Creates a tuple expression containing a single expression.
expr - the expression to add (non-null)Creates a tuple expression containing two expressions.
expr1 - the first expression (non-null)expr2 - the second expression (non-null)Creates a tuple expression containing three expressions.
expr1 - the first expression (non-null)expr2 - the second expression (non-null)expr3 - the third expression (non-null)Creates a tuple expression with pre-allocated capacity.
capacity - the initial capacity for the internal listCreates a tuple expression from an existing list of expressions.
expressions - the list of expressions (non-null)Creates a tuple expression from an array of expressions.
expressionArray - the array of expressions (non-null)Adds an expression to this tuple.
expression - the expression to add (non-null)Returns the expression at the specified index.
i - the index of the expressionReturns the list of all expressions in this tuple. Note: The returned list may be mutable; modifications affect this tuple.
Returns an unmodifiable iterator over the expressions in this tuple.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.