Top Description Fields Constructors Methods
org.codehaus.groovy.ast.expr

public Class ArrayExpression

extends Expression
Class Inheritance
Imports
org.codehaus.groovy.ast.ClassNode, .GroovyCodeVisitor, java.util.Collections, .List, java.util.stream.Collectors

Represents an array object construction. One of:

Field Summary

Modifier and TypeField and Description
private final ClassNode
private final List<Expression>
private final List<Expression>
Inherited from org.codehaus.groovy.ast.expr.Expression:
EMPTY_ARRAY

Constructor Summary

AccessConstructor and Description
public
ArrayExpression(ClassNode elementType, List<Expression> initExpressions, List<Expression> sizeExpressions)

public
ArrayExpression(ClassNode elementType, List<Expression> initExpressions)

Creates an array using an initializer (list of expressions corresponding to array elements)

Method Summary

Modifier and TypeMethod and Description
public void
addExpression(Expression initExpression)

Add another element to the initializer expressions

private String
private String
public ClassNode
public Expression
getExpression(int i)

Get a particular initializer expression

public List<Expression>
getExpressions()

Get the initializer expressions

public List<Expression>

Returns:

a list with elements corresponding to the array's dimensions
getSizeExpression
()

public String
public boolean

Returns:

true if the array expression is defined by an explicit initializer
hasInitializer
()

public boolean
private static ClassNode
makeArray(ClassNode base, List<Expression> sizeExpressions)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public Expression
transformExpression(ExpressionTransformer transformer)

Implements abstract org.codehaus.groovy.ast.expr.Expression.transformExpression.

Return a copy of the expression calling the transformer on any nested expressions
public void
Inherited from org.codehaus.groovy.ast.expr.Expression:
getTypesetTypetransformExpressionstransformExpressions

Field Detail

elementTypeback to summary
private final ClassNode elementType
initExpressionsback to summary
private final List<Expression> initExpressions
sizeExpressionsback to summary
private final List<Expression> sizeExpressions

Constructor Detail

ArrayExpressionback to summary
public ArrayExpression(ClassNode elementType, List<Expression> initExpressions, List<Expression> sizeExpressions)
ArrayExpressionback to summary
public ArrayExpression(ClassNode elementType, List<Expression> initExpressions)

Creates an array using an initializer (list of expressions corresponding to array elements)

Method Detail

addExpressionback to summary
public void addExpression(Expression initExpression)

Add another element to the initializer expressions

formatInitExpressionsback to summary
private String formatInitExpressions()
formatSizeExpressionsback to summary
private String formatSizeExpressions()
getElementTypeback to summary
public ClassNode getElementType()
getExpressionback to summary
public Expression getExpression(int i)

Get a particular initializer expression

getExpressionsback to summary
public List<Expression> getExpressions()

Get the initializer expressions

getSizeExpressionback to summary
public List<Expression> getSizeExpression()
Returns:List<Expression>

a list with elements corresponding to the array's dimensions

getTextback to summary
public String getText()

Overrides org.codehaus.groovy.ast.ASTNode.getText.

hasInitializerback to summary
public boolean hasInitializer()
Returns:boolean

true if the array expression is defined by an explicit initializer

isDynamicback to summary
public boolean isDynamic()
makeArrayback to summary
private static ClassNode makeArray(ClassNode base, List<Expression> sizeExpressions)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

transformExpressionback to summary
public Expression transformExpression(ExpressionTransformer transformer)

Implements abstract org.codehaus.groovy.ast.expr.Expression.transformExpression.

Doc from org.codehaus.groovy.ast.expr.Expression.transformExpression.

Return a copy of the expression calling the transformer on any nested expressions

visitback to summary
public void visit(GroovyCodeVisitor visitor)

Overrides org.codehaus.groovy.ast.ASTNode.visit.