Interface ExpressionDef

All Known Subinterfaces:
InstanceDef, VariableDef
All Known Implementing Classes:
ExpressionDef.CallInstanceMethod, ExpressionDef.CallStaticMethod, ExpressionDef.Condition, ExpressionDef.Constant, ExpressionDef.Convert, ExpressionDef.IfElse, ExpressionDef.NewInstance, VariableDef.Field, VariableDef.Local, VariableDef.MethodParameter, VariableDef.StaticField, VariableDef.This

The expression definition.
Since:
1.0
Author:
Denis Stepanov
  • Method Details

    • nullValue

      @NonNull static @NonNull ExpressionDef nullValue()
      Returns:
      The null value expression
    • trueValue

      @NonNull static @NonNull ExpressionDef trueValue()
      Returns:
      The true value expression
    • falseValue

      @NonNull static @NonNull ExpressionDef falseValue()
      Returns:
      The true value expression
    • returning

      default StatementDef returning()
      The statement returning this expression.
      Returns:
      The statement returning this expression
    • asConditionIf

      default StatementDef asConditionIf(StatementDef statement)
      The conditional statement based on this expression.
      Parameters:
      statement - The statement
      Returns:
      The statement returning this expression
    • asConditionIfElse

      default StatementDef asConditionIfElse(StatementDef statement, StatementDef elseStatement)
      The conditional statement based on this expression.
      Parameters:
      statement - The statement
      elseStatement - The else statement
      Returns:
      The statement returning this expression
    • asConditionIfElse

      default ExpressionDef asConditionIfElse(ExpressionDef expression, ExpressionDef elseExpression)
      The conditional if else expression.
      Parameters:
      expression - The expression
      elseExpression - The else expression
      Returns:
      The statement returning this expression
    • constant

      @Nullable static @Nullable ExpressionDef constant(io.micronaut.inject.ast.ClassElement type, TypeDef typeDef, @Nullable @Nullable String stringValue)
      Resolve a constant for the given type from the string.
      Parameters:
      type - The type
      typeDef - The type def
      stringValue - The string value
      Returns:
      The constant
      Throws:
      IllegalArgumentException - if the constant is not supported.
    • type

      TypeDef type()
      The type of the expression.
      Returns:
      The type
    • instantiate

      static ExpressionDef.NewInstance instantiate(ClassTypeDef type)
      The new instance expression.
      Parameters:
      type - The type
      Returns:
      The new instance
    • instantiate

      static ExpressionDef.NewInstance instantiate(ClassTypeDef type, List<ExpressionDef> values)
      The new instance expression.
      Parameters:
      type - The type
      values - The constructor values
      Returns:
      The new instance
    • invoke

      static ExpressionDef.CallInstanceMethod invoke(VariableDef instance, String name, List<ExpressionDef> parameters, TypeDef returning)
      The call the instance method expression.
      Parameters:
      instance - The instance
      name - The method name
      parameters - The parameters
      returning - The returning
      Returns:
      The call to the instance method
    • invokeStatic

      static ExpressionDef.CallStaticMethod invokeStatic(ClassTypeDef typeDef, String name, List<ExpressionDef> parameters, TypeDef returning)
      The call the instance method expression.
      Parameters:
      typeDef - The class type def
      name - The method name
      parameters - The parameters
      returning - The returning
      Returns:
      The call to the static method