Class NewExpression

All Implemented Interfaces:
INewExpression, IExpression, IHasArguments, IHasType, IParsedElement
Direct Known Subclasses:
AnnotationExpression, InferredNewExpression

public class NewExpression extends Expression implements INewExpression
The 'new' operator as an expression:
 new-expression
   new <type-expression> ( [<argument-list>] ) [ {...} ]
   new <type-expression> [ <expression> ]
   new <type-expression> [] { [<array-value-list>] }
 
See Also:
  • Field Details

  • Constructor Details

    • NewExpression

      public NewExpression()
      Constructs a BeanMethodCallExpression given an ISymbolTable instance.
  • Method Details

    • getArgTypes

      public IType[] getArgTypes()
      Specified by:
      getArgTypes in interface INewExpression
      Returns:
      An array of IType for the arguments of the method call.
    • setArgTypes

      public void setArgTypes(IType... argTypes)
      Parameters:
      argTypes - An array of IType for the arguments of the method call.
    • getArgs

      public Expression[] getArgs()
      Specified by:
      getArgs in interface IHasArguments
      Specified by:
      getArgs in interface INewExpression
      Returns:
      An array of expressions for corresponding to the arguments in the expression.
    • setArgs

      public void setArgs(Expression[] args)
      Parameters:
      args - An array of expressions for corresponding to the arguments in the expression.
    • getConstructor

      public IConstructorInfo getConstructor()
      Specified by:
      getConstructor in interface INewExpression
    • getArgPosition

      public int getArgPosition()
      Specified by:
      getArgPosition in interface IHasArguments
    • setArgPosition

      public void setArgPosition(int iArgPos)
    • setConstructor

      public void setConstructor(IConstructorInfo constructor)
      The constructor for the new operation.

      The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive.

    • setValueExpressions

      public void setValueExpressions(List<Expression> valueExpressions)
      The value expression for the new array operation.

      The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive.

    • getValueExpressions

      public List<Expression> getValueExpressions()
      Specified by:
      getValueExpressions in interface INewExpression
    • setInitializer

      public void setInitializer(IInitializerExpression initializerExpression)
    • getInitializer

      public IInitializerExpression getInitializer()
      Specified by:
      getInitializer in interface INewExpression
    • addSizeExpression

      public void addSizeExpression(Expression sizeExpression)
      The size expression for the new array operation.

      The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive.

    • getSizeExpressions

      public List<Expression> getSizeExpressions()
      Specified by:
      getSizeExpressions in interface INewExpression
    • isCompileTimeConstant

      public boolean isCompileTimeConstant()
      Specified by:
      isCompileTimeConstant in interface IParsedElement
      Overrides:
      isCompileTimeConstant in class ParsedElement
    • evaluate

      public Object evaluate()
      Description copied from interface: IExpression
      Evaluates this Expression and returns the result.
      Specified by:
      evaluate in interface IExpression
      Overrides:
      evaluate in class Expression
    • getArrayClass

      private Class<?> getArrayClass(IType type)
    • getComponentClass

      private Class<?> getComponentClass(IType type)
    • getClassForRareCaseWhenRunningIJEditorProjectWhereGosuCoreJavaTypesAreSourceBased

      private Class<?> getClassForRareCaseWhenRunningIJEditorProjectWhereGosuCoreJavaTypesAreSourceBased(IType type)
    • toString

      public String toString()
      Description copied from class: Expression
      Subclasses should return a String representing the parsed expression.
      Specified by:
      toString in class Expression
    • isAnonymousClass

      public boolean isAnonymousClass()
      Specified by:
      isAnonymousClass in interface INewExpression
    • setAnonymousClass

      public void setAnonymousClass(boolean anonymous)
    • getTypeLiteral

      public ITypeLiteralExpression getTypeLiteral()
      Specified by:
      getTypeLiteral in interface INewExpression
    • setTypeLiteral

      public void setTypeLiteral(ITypeLiteralExpression typeLiteral)
    • getNamedArgOrder

      public int[] getNamedArgOrder()
    • setNamedArgOrder

      public void setNamedArgOrder(int[] namedArgOrder)