Package net.bytebuddy.implementation
Class EqualsMethod.ConditionalReturn
- java.lang.Object
-
- net.bytebuddy.implementation.EqualsMethod.ConditionalReturn
-
- All Implemented Interfaces:
StackManipulation
- Enclosing class:
- EqualsMethod
@Enhance protected static class EqualsMethod.ConditionalReturn extends java.lang.Object implements StackManipulation
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.Compound, StackManipulation.Illegal, StackManipulation.Size, StackManipulation.Trivial
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.Object[]EMPTYAn empty array.private intjumpConditionThe conditional jump instruction upon which the return is not triggered.private intvalueThe opcode for the value being returned.
-
Constructor Summary
Constructors Modifier Constructor Description protectedConditionalReturn(int jumpCondition)Creates a conditional return for a value offalse.privateConditionalReturn(int jumpCondition, int value)Creates a conditional return.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StackManipulation.Sizeapply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext)Applies the stack manipulation that is described by this instance.booleanisValid()Determines if this stack manipulation is valid.protected static EqualsMethod.ConditionalReturnonIdentity()Returns a conditional return that returns if two reference values are identical.protected static EqualsMethod.ConditionalReturnonNonEqualInteger()Returns a conditional return that returns if twointvalues are not equal.protected static EqualsMethod.ConditionalReturnonNonIdentity()Returns a conditional return that returns if two reference values are not identical.protected static EqualsMethod.ConditionalReturnonNonZeroInteger()Returns a conditional return that returns on anintvalue of not0.protected static EqualsMethod.ConditionalReturnonNullValue()Returns a conditional return that returns on a reference value ofnull.protected static EqualsMethod.ConditionalReturnonZeroInteger()Returns a conditional return that returns on anintvalue of0.protected StackManipulationreturningTrue()Returns a new stack manipulation that returnstruefor the given condition.
-
-
-
Constructor Detail
-
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 Detail
-
onZeroInteger
protected static EqualsMethod.ConditionalReturn onZeroInteger()
Returns a conditional return that returns on anintvalue of0.- Returns:
- A conditional return that returns on an
intvalue of0.
-
onNonZeroInteger
protected static EqualsMethod.ConditionalReturn onNonZeroInteger()
Returns a conditional return that returns on anintvalue of not0.- Returns:
- A conditional return that returns on an
intvalue of not0.
-
onNullValue
protected static EqualsMethod.ConditionalReturn 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
protected static EqualsMethod.ConditionalReturn 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
protected static EqualsMethod.ConditionalReturn 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
protected static EqualsMethod.ConditionalReturn 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
protected StackManipulation returningTrue()
Returns a new stack manipulation that returnstruefor the given condition.- Returns:
- A new stack manipulation that returns
truefor the given condition.
-
isValid
public boolean isValid()
Determines if this stack manipulation is valid.- Specified by:
isValidin interfaceStackManipulation- Returns:
- If
false, this manipulation cannot be applied and should throw an exception.
-
apply
public StackManipulation.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext)
Applies the stack manipulation that is described by this instance.- Specified by:
applyin interfaceStackManipulation- 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.
-
-