Package net.bytebuddy.implementation
Class EqualsMethod.ConditionalReturn
java.lang.Object
net.bytebuddy.implementation.bytecode.StackManipulation.AbstractBase
net.bytebuddy.implementation.EqualsMethod.ConditionalReturn
- All Implemented Interfaces:
StackManipulation
- Enclosing class:
EqualsMethod
@Enhance
protected static class EqualsMethod.ConditionalReturn
extends StackManipulation.AbstractBase
A conditional return aborts the equality computation if a given condition was reached.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bytecode.StackManipulation
StackManipulation.AbstractBase, StackManipulation.Compound, StackManipulation.Illegal, StackManipulation.Simple, StackManipulation.Size, StackManipulation.Trivial -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Object[]An empty array.private final intThe conditional jump instruction upon which the return is not triggered.private final intThe opcode for the value being returned. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConditionalReturn(int jumpCondition) Creates a conditional return for a value offalse.privateConditionalReturn(int jumpCondition, int value) Creates a conditional return. -
Method Summary
Modifier and TypeMethodDescriptionapply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext) Applies the stack manipulation that is described by this instance.protected static EqualsMethod.ConditionalReturnReturns a conditional return that returns if two reference values are identical.protected static EqualsMethod.ConditionalReturnReturns a conditional return that returns if twointvalues are not equal.protected static EqualsMethod.ConditionalReturnReturns a conditional return that returns if two reference values are not identical.protected static EqualsMethod.ConditionalReturnReturns a conditional return that returns on anintvalue of not0.protected static EqualsMethod.ConditionalReturnReturns a conditional return that returns on a reference value ofnull.protected static EqualsMethod.ConditionalReturnReturns a conditional return that returns on anintvalue of0.protected StackManipulationReturns a new stack manipulation that returnstruefor the given condition.Methods inherited from class net.bytebuddy.implementation.bytecode.StackManipulation.AbstractBase
isValid
-
Field Details
-
EMPTY
An empty array. -
jumpCondition
private final int jumpConditionThe conditional jump instruction upon which the return is not triggered. -
value
private final int valueThe opcode for the value being returned.
-
-
Constructor Details
-
ConditionalReturn
protected ConditionalReturn(int jumpCondition) Creates a conditional return for a value offalse.- Parameters:
jumpCondition- The opcode upon which the return is not triggered.
-
ConditionalReturn
private ConditionalReturn(int jumpCondition, int value) Creates a conditional return.- Parameters:
jumpCondition- The opcode upon which the return is not triggered.value- The opcode for the value being returned.
-
-
Method Details
-
onZeroInteger
Returns a conditional return that returns on anintvalue of0.- Returns:
- A conditional return that returns on an
intvalue of0.
-
onNonZeroInteger
Returns a conditional return that returns on anintvalue of not0.- Returns:
- A conditional return that returns on an
intvalue of not0.
-
onNullValue
Returns a conditional return that returns on a reference value ofnull.- Returns:
- A conditional return that returns on a reference value of
null.
-
onNonIdentity
Returns a conditional return that returns if two reference values are not identical.- Returns:
- A conditional return that returns if two reference values are not identical.
-
onIdentity
Returns a conditional return that returns if two reference values are identical.- Returns:
- A conditional return that returns if two reference values are identical.
-
onNonEqualInteger
Returns a conditional return that returns if twointvalues are not equal.- Returns:
- A conditional return that returns if two
intvalues are not equal.
-
returningTrue
Returns a new stack manipulation that returnstruefor the given condition.- Returns:
- A new stack manipulation that returns
truefor the given condition.
-
apply
public StackManipulation.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext) Applies the stack manipulation that is described by this instance.- Parameters:
methodVisitor- The method visitor used to write the method implementation to.implementationContext- The context of the current implementation.- Returns:
- The changes to the size of the operand stack that are implied by this stack manipulation.
-