Package io.quarkus.gizmo
Class AbstractSwitch<T>
java.lang.Object
io.quarkus.gizmo.BytecodeCreatorImpl
io.quarkus.gizmo.AbstractSwitch<T>
- All Implemented Interfaces:
BytecodeCreator,Switch<T>,AutoCloseable
- Direct Known Subclasses:
EnumSwitchImpl,StringSwitchImpl
-
Nested Class Summary
Nested classes/interfaces inherited from class io.quarkus.gizmo.BytecodeCreatorImpl
BytecodeCreatorImpl.AssignOperation, BytecodeCreatorImpl.BlockOperation, BytecodeCreatorImpl.IfOperation, BytecodeCreatorImpl.InvokeOperation, BytecodeCreatorImpl.JumpOperation, BytecodeCreatorImpl.NewInstanceOperation, BytecodeCreatorImpl.OperationNested classes/interfaces inherited from interface io.quarkus.gizmo.Switch
Switch.EnumSwitch<E extends Enum<E>>, Switch.StringSwitch -
Field Summary
FieldsFields inherited from class io.quarkus.gizmo.BytecodeCreatorImpl
MAX_STRING_LENGTH, operations -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddefaultCase(Consumer<BytecodeCreator> defatultBlockConsumer) Adds the default block.voiddoBreak(BytecodeCreator creator) Writes bytecode into the providedBytecodeCreatorto make it exit the switch, effectively issuing a Java 'break' statement.voidEnables fall through.Methods inherited from class io.quarkus.gizmo.BytecodeCreatorImpl
add, allocateLocalVariables, arrayLength, assign, bitwiseAnd, bitwiseOr, bitwiseXor, breakScope, checkCast, checkScope, checkScope, compareDouble, compareFloat, compareLong, continueScope, convertPrimitive, createFunction, createNewInstanceOp, createScope, createVariable, divide, enumSwitch, findActiveResultHandles, forEach, getBottom, getMethod, getMethodParam, getOwner, getThis, getTop, ifFalse, ifGreaterEqualZero, ifGreaterThanZero, ifIntegerEqual, ifIntegerGreaterEqual, ifIntegerGreaterThan, ifIntegerLessEqual, ifIntegerLessThan, ifLessEqualZero, ifLessThanZero, ifNonZero, ifNotNull, ifNull, ifReferencesEqual, ifReferencesNotEqual, ifThenElse, ifTrue, ifZero, instanceOf, invokeInterfaceMethod, invokeSpecialInterfaceMethod, invokeSpecialMethod, invokeStaticInterfaceMethod, invokeStaticMethod, invokeVirtualMethod, isScopedWithin, jumpTo, load, load, load, load, load, load, load, load, load, loadClass, loadClassFromTCCL, loadNull, loadResultHandle, loadResultHandle, multiply, newArray, newInstance, readArrayValue, readInstanceField, readStaticField, remainder, resolve, resolve, resolve, resolve, returnValue, storeResultHandle, stringSwitch, subtract, throwException, tryBlock, whileLoop, writeArrayValue, writeInstanceField, writeInteriorOperations, writeOperations, writeStaticFieldMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.quarkus.gizmo.BytecodeCreator
breakScope, checkCast, close, continueScope, createVariable, increment, instanceOf, invokeInterfaceMethod, invokeSpecialInterfaceMethod, invokeSpecialMethod, invokeStaticInterfaceMethod, invokeStaticMethod, invokeVirtualMethod, load, loadClass, loadClass, loadClassFromTCCL, loadClassFromTCCL, marshalAsArray, newArray, newArray, newArray, newInstance, readArrayValue, readInstanceField, readStaticField, returnBoolean, returnInt, returnNull, returnVoid, throwException, throwException, writeArrayValue, writeInstanceField, writeStaticField
-
Field Details
-
fallThrough
protected boolean fallThrough -
defaultBlock
-
-
Constructor Details
-
AbstractSwitch
AbstractSwitch(BytecodeCreatorImpl enclosing)
-
-
Method Details
-
fallThrough
public void fallThrough()Description copied from interface:SwitchEnables fall through.By default, the fall through is disabled. A case block is treated as a switch rule block; i.e. it's not necessary to add the break statement to prevent the fall through. However, if fall through is enabled then a case block is treated as a labeled statement group; i.e. it's necessary to add the break statement to prevent the fall through.
For example, if fall through is disabled then:
is an equivalent of:StringSwitch s = method.stringSwitch(val); s.caseOf(List.of("boom", "foo"), bc -> {...});switch (val) { case "boom", "foo" -> // statements provided by the consumer }However, if fall though is enabled then:
is an equivalent of:StringSwitch s = method.stringSwitch(val); s.fallThrough(); s.caseOf(List.of("boom", "foo"), bc -> {...});switch (val) { case "val1": case "val2": // statements provided by the consumer }- Specified by:
fallThroughin interfaceSwitch<T>
-
defaultCase
Description copied from interface:SwitchAdds the default block.- Specified by:
defaultCasein interfaceSwitch<T>- Parameters:
defatultBlockConsumer-
-
doBreak
Description copied from interface:SwitchWrites bytecode into the providedBytecodeCreatorto make it exit the switch, effectively issuing a Java 'break' statement.
-