Package io.micronaut.sourcegen.model
Record Class StatementDef.Switch
java.lang.Object
java.lang.Record
io.micronaut.sourcegen.model.StatementDef.Switch
- Record Components:
expression- The switch expressiontype- The switch typecases- The cases
- All Implemented Interfaces:
StatementDef
- Enclosing interface:
- StatementDef
public static record StatementDef.Switch(ExpressionDef expression, TypeDef type, Map<ExpressionDef.Constant,StatementDef> cases)
extends Record
implements StatementDef
The switch statement.
Note: null constant or null value represents a default case.
- Since:
- 1.2
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.sourcegen.model.StatementDef
StatementDef.Assign, StatementDef.DefineAndAssign, StatementDef.If, StatementDef.IfElse, StatementDef.Multi, StatementDef.Return, StatementDef.Switch, StatementDef.Throw, StatementDef.While -
Constructor Summary
ConstructorsConstructorDescriptionSwitch(ExpressionDef expression, TypeDef type, Map<ExpressionDef.Constant, StatementDef> cases) Creates an instance of aSwitchrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncases()Returns the value of thecasesrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexpressionrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.micronaut.sourcegen.model.StatementDef
after, flatten
-
Constructor Details
-
Switch
public Switch(ExpressionDef expression, TypeDef type, Map<ExpressionDef.Constant, StatementDef> cases) Creates an instance of aSwitchrecord class.- Parameters:
expression- the value for theexpressionrecord componenttype- the value for thetyperecord componentcases- the value for thecasesrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
expression
Returns the value of theexpressionrecord component.- Returns:
- the value of the
expressionrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
cases
Returns the value of thecasesrecord component.- Returns:
- the value of the
casesrecord component
-