Package io.quarkus.gizmo
Class IfThenElseImpl
java.lang.Object
io.quarkus.gizmo.BytecodeCreatorImpl
io.quarkus.gizmo.IfThenElseImpl
- All Implemented Interfaces:
BytecodeCreator,IfThenElse,AutoCloseable
-
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.Operation -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static byteprivate static byteprivate static byteprivate BranchResultprivate byteprivate static byteFields inherited from class io.quarkus.gizmo.BytecodeCreatorImpl
MAX_STRING_LENGTH, operations -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate IllegalStateExceptionelseIf(ResultHandle value) Creates a new else-if statement.Creates a new else-if statement.elseThen()This block is executed if no condition result handle was evaluated astrue.private IllegalStateExceptionthen()This block is executed if the result handle that was passed toBytecodeCreator.ifThenElse(ResultHandle)is evaluated astrue.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
-
state
private byte state -
result
-
INIT
private static byte INIT -
THEN
private static byte THEN -
ELSEIF
private static byte ELSEIF -
ELSE
private static byte ELSE
-
-
Constructor Details
-
IfThenElseImpl
-
-
Method Details
-
then
Description copied from interface:IfThenElseThis block is executed if the result handle that was passed toBytecodeCreator.ifThenElse(ResultHandle)is evaluated astrue.- Specified by:
thenin interfaceIfThenElse- Returns:
- the
thenblock
-
elseIf
Description copied from interface:IfThenElseCreates a new else-if statement. The block is executed if the condition result handle is evaluated astrue.Note that the condition result handle must already exist.
boolean test = foo.testIsOk(); if (someOtherCondition) { // do action "A" } else if (test) { // do action "B" }If you need to create the condition result handle inside the if-else statement then use theIfThenElse.elseIf(Function)method instead.- Specified by:
elseIfin interfaceIfThenElse- Parameters:
value-- Returns:
- the
else-ifblock
-
elseIf
Description copied from interface:IfThenElseCreates a new else-if statement. The block is executed if the condition result handle returned from the function is evaluated astrue.The argument of the function represents the block that is executed when the else-if statement is evaluated.
In order to generate the bytecode for the "action B" branch in the following example:
if (someOtherCondition) { // do action "A" } else if (foo.testIsOk()) { // do action "B" }The code needs to look like:IfThenElse ifAction = method.ifThenElse(someOtherCondition); BytecodeCreator ifTestOk = ifValue.elseIf(b -> b.invokeVirtualMethod(testIsOkMethodDescriptor, fooInstance))); // do action "B"
- Specified by:
elseIfin interfaceIfThenElse- Parameters:
test-- Returns:
- the
else-ifblock
-
elseThen
Description copied from interface:IfThenElseThis block is executed if no condition result handle was evaluated astrue.- Specified by:
elseThenin interfaceIfThenElse- Returns:
- the
elseblock
-
initialThenNotCreated
-
elseAlreadyCreated
-