Package: org.codehaus.groovy.ast.expr

## [Java] Class ArrayExpression

- org.codehaus.groovy.ast.expr.ArrayExpression

-     public class ArrayExpression
      extends Expression

  Represents an array object construction. One of:

  - a fixed size array (e.g. `new String[3]` or `new Integer[2][3])`
  - an array with an explicit initializer (e.g. `new String[]{ "foo", "bar" }`)

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

  - ### Constructor Summary

    Constructors
    Constructor and description
    `ArrayExpression(ClassNode elementType, List<Expression> initExpressions, List<Expression> sizeExpressions)`
    `ArrayExpression(ClassNode elementType, List<Expression> initExpressions)` Creates an array using an initializer (list of expressions corresponding to array elements)

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `addExpression(Expression initExpression)` Add another element to the initializer expressions
    `` | `public ClassNode` | `getElementType()`
    `` | `public Expression` | `getExpression(int i)` Get a particular initializer expression
    `` | `public List<Expression>` | `getExpressions()` Get the initializer expressions
    `` | `public List<Expression>` | `getSizeExpression()` Returns: a list with elements corresponding to the array's dimensions
    `` | `public String` | `getText()`
    `` | `public boolean` | `hasInitializer()` Returns: true if the array expression is defined by an explicit initializer
    `` | `public boolean` | `isDynamic()`
    `` | `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`
    `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 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 Detail

    - #### public void addExpression(Expression initExpression)

      Add another element to the initializer expressions

    - #### public ClassNode getElementType()

    - #### public Expression getExpression(int i)

      Get a particular initializer expression

    - #### public List<Expression> getExpressions()

      Get the initializer expressions

    - #### public List<Expression> getSizeExpression()

      Returns:
        a list with elements corresponding to the array's dimensions

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

    - #### public boolean hasInitializer()

      Returns:
        true if the array expression is defined by an explicit initializer

    - #### public boolean isDynamic()

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

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

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