public enum IntegerConstant extends Enum<IntegerConstant> implements StackManipulation
int
constant onto the operand stack. Note that within the JVM,
boolean
, byte
, short
and char
values are represented by integers and can therefore
be loaded by using this class.StackManipulation.Compound, StackManipulation.Size
Enum Constant and Description |
---|
FIVE |
FOUR |
MINUS_ONE |
ONE |
THREE |
TWO |
ZERO |
Modifier and Type | Method and Description |
---|---|
StackManipulation.Size |
apply(org.objectweb.asm.MethodVisitor methodVisitor,
Instrumentation.Context instrumentationContext)
Applies the stack manipulation that is described by this instance.
|
static StackManipulation |
forValue(boolean value)
Creates a stack manipulation for loading a boolean value onto the stack.
|
static StackManipulation |
forValue(int value)
Creates a stack manipulation for loading an
int value onto the stack. |
boolean |
isValid()
Determines if this stack manipulation is valid.
|
static IntegerConstant |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static IntegerConstant[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final IntegerConstant MINUS_ONE
public static final IntegerConstant ZERO
public static final IntegerConstant ONE
public static final IntegerConstant TWO
public static final IntegerConstant THREE
public static final IntegerConstant FOUR
public static final IntegerConstant FIVE
public static IntegerConstant[] values()
for (IntegerConstant c : IntegerConstant.values()) System.out.println(c);
public static IntegerConstant valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static StackManipulation forValue(boolean value)
value
- The boolean
to load onto the stack.boolean
.public static StackManipulation forValue(int value)
int
value onto the stack.
This is achieved either by invoking a constant opcode, if any, or by creating a binary push operation.
value
- The int
(or byte
, short
, char
) value to load onto the stack.public boolean isValid()
StackManipulation
isValid
in interface StackManipulation
false
, this manipulation cannot be applied and should throw an exception.public StackManipulation.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Instrumentation.Context instrumentationContext)
StackManipulation
apply
in interface StackManipulation
methodVisitor
- The method visitor used to write the method implementation to.instrumentationContext
- The context of the current instrumentation.Copyright © 2014. All rights reserved.