Interface CtNewArray<T>

Type Parameters:
T - type of this array (should be a array...)
All Superinterfaces:
Cloneable, CtCodeElement, CtElement, CtExpression<T>, CtQueryable, CtTypedElement<T>, CtVisitable, FactoryAccessor, Serializable, SourcePositionHolder, TemplateParameter<T>
All Known Implementing Classes:
CtNewArrayImpl

public interface CtNewArray<T> extends CtExpression<T>
This code element defines the inline creation of a new array. Example:
     // inline creation of array content
     int[] x = new int[] { 0, 1, 42}
 
  • Method Details

    • getDimensionExpressions

      List<CtExpression<Integer>> getDimensionExpressions()
      Gets the expressions that define the array's dimensions.
    • setDimensionExpressions

      <C extends CtNewArray<T>> C setDimensionExpressions(List<CtExpression<Integer>> dimensions)
      Sets the expressions that define the array's dimensions.
    • addDimensionExpression

      <C extends CtNewArray<T>> C addDimensionExpression(CtExpression<Integer> dimension)
      Adds a dimension expression.
    • removeDimensionExpression

      boolean removeDimensionExpression(CtExpression<Integer> dimension)
      Removes a dimension expression.
    • getElements

      List<CtExpression<?>> getElements()
      Gets the initialization expressions.
    • setElements

      <C extends CtNewArray<T>> C setElements(List<CtExpression<?>> expression)
      Sets the initialization expressions.
    • addElement

      <C extends CtNewArray<T>> C addElement(CtExpression<?> expression)
      Adds an element.
    • removeElement

      boolean removeElement(CtExpression<?> expression)
      Removes an element.
    • clone

      CtNewArray<T> clone()
      Description copied from interface: CtElement
      Clone the element which calls this method in a new object. Note that that references are kept as is, and thus, so if you clone whole classes or methods, some parts of the cloned element (eg executable references) may still point to the initial element. In this case, consider using methods Refactoring.copyType(CtType) and Refactoring.copyMethod(CtMethod) instead which does additional work beyond cloning.
      Specified by:
      clone in interface CtCodeElement
      Specified by:
      clone in interface CtElement
      Specified by:
      clone in interface CtExpression<T>