Package io.micronaut.sourcegen.model
Interface VariableDef
- All Superinterfaces:
ExpressionDef
- All Known Subinterfaces:
InstanceDef
- All Known Implementing Classes:
ExpressionDef.NewInstance
,VariableDef.Field
,VariableDef.Local
,VariableDef.MethodParameter
,VariableDef.StaticField
,VariableDef.This
public sealed interface VariableDef
extends ExpressionDef
permits InstanceDef, VariableDef.Field, VariableDef.Local, VariableDef.MethodParameter, VariableDef.StaticField, VariableDef.This
The variable definition.
- Since:
- 1.0
- Author:
- Denis Stepanov
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record
The variable of a field.static final record
The local variable.static final record
The variable of a method parameter.static final record
The variable of a static field.static final record
The variable of `this`.Nested classes/interfaces inherited from interface io.micronaut.sourcegen.model.ExpressionDef
ExpressionDef.CallInstanceMethod, ExpressionDef.CallStaticMethod, ExpressionDef.Condition, ExpressionDef.Constant, ExpressionDef.Convert, ExpressionDef.IfElse, ExpressionDef.NewInstance
-
Method Summary
Modifier and TypeMethodDescriptiondefault ExpressionDef
asCondition
(String op, ExpressionDef expression) The condition of this variable.default StatementDef
assign
(ExpressionDef expression) Assign this variable an expression.default ExpressionDef
Convert this variable to a different type.default ExpressionDef
default ExpressionDef
isNull()
Methods inherited from interface io.micronaut.sourcegen.model.ExpressionDef
asConditionIf, asConditionIfElse, asConditionIfElse, returning, type
-
Method Details
-
asCondition
The condition of this variable.- Parameters:
op
- The operatorexpression
- The expression of this variable- Returns:
- The condition expression
-
isNonNull
- Returns:
- Is non-null expression
-
isNull
- Returns:
- Is null expression
-
convert
Convert this variable to a different type.- Parameters:
typeDef
- The type- Returns:
- the convert expression
-
assign
Assign this variable an expression.- Parameters:
expression
- The expression.- Returns:
- The statement
-