Interface CtExpression<T>

Type Parameters:
T - the "return type" of this expression
All Superinterfaces:
Cloneable, CtCodeElement, CtElement, CtQueryable, CtTypedElement<T>, CtVisitable, FactoryAccessor, Serializable, SourcePositionHolder, TemplateParameter<T>
All Known Subinterfaces:
CtAnnotation<A>, CtAnnotationFieldAccess<T>, CtArrayAccess<T,E>, CtArrayRead<T>, CtArrayWrite<T>, CtAssignment<T,A>, CtBinaryOperator<T>, CtCasePattern, CtCodeSnippetExpression<T>, CtConditional<T>, CtConstructorCall<T>, CtExecutableReferenceExpression<T,E>, CtFieldAccess<T>, CtFieldRead<T>, CtFieldWrite<T>, CtInvocation<T>, CtLambda<T>, CtLiteral<T>, CtNewArray<T>, CtNewClass<T>, CtOperatorAssignment<T,A>, CtRecordPattern, CtSuperAccess<T>, CtSwitchExpression<T,S>, CtTargetedExpression<T,E>, CtTextBlock, CtThisAccess<T>, CtTypeAccess<A>, CtTypePattern, CtUnaryOperator<T>, CtUnnamedPattern, CtVariableAccess<T>, CtVariableRead<T>, CtVariableWrite<T>
All Known Implementing Classes:
CtAnnotationFieldAccessImpl, CtAnnotationImpl, CtArrayAccessImpl, CtArrayReadImpl, CtArrayWriteImpl, CtAssignmentImpl, CtBinaryOperatorImpl, CtCasePatternImpl, CtCodeSnippetExpressionImpl, CtConditionalImpl, CtConstructorCallImpl, CtExecutableReferenceExpressionImpl, CtExpressionImpl, CtFieldAccessImpl, CtFieldReadImpl, CtFieldWriteImpl, CtInvocationImpl, CtLambdaImpl, CtLiteralImpl, CtNewArrayImpl, CtNewClassImpl, CtOperatorAssignmentImpl, CtRecordPatternImpl, CtSuperAccessImpl, CtSwitchExpressionImpl, CtTargetedExpressionImpl, CtTextBlockImpl, CtThisAccessImpl, CtTypeAccessImpl, CtTypePatternImpl, CtUnaryOperatorImpl, CtUnnamedPatternImpl, CtVariableAccessImpl, CtVariableReadImpl, CtVariableWriteImpl

public interface CtExpression<T> extends CtCodeElement, CtTypedElement<T>, TemplateParameter<T>
This abstract code element defines a typed expression.
  • Method Details

    • getTypeCasts

      List<CtTypeReference<?>> getTypeCasts()
      Returns the type casts if any.
      Returns:
      this object
    • setTypeCasts

      <C extends CtExpression<T>> C setTypeCasts(List<CtTypeReference<?>> types)
      Sets the type casts.
      Returns:
      this object
    • addTypeCast

      <C extends CtExpression<T>> C addTypeCast(CtTypeReference<?> type)
      Adds a type cast.
      Returns:
      this object
    • clone

      CtExpression<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
      Returns:
      a clone of this element. All children are cloned, but the parent of the returned clone is set to null.