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.Modifier and Type | Class and Description |
---|---|
protected static class |
IntegerConstant.ConstantPool
A stack manipulation that loads a JVM-integer value from a constant pool value onto the operand stack.
|
protected static class |
IntegerConstant.SingleBytePush
A stack manipulation that loads a JVM-integer value by a
BIPUSH operation which is
legal for single byte integer values. |
protected static class |
IntegerConstant.TwoBytePush
A stack manipulation that loads a JVM-integer value by a
SIPUSH operation which is
legal for up to two byte integer values. |
StackManipulation.AbstractBase, StackManipulation.Compound, StackManipulation.Illegal, StackManipulation.Simple, StackManipulation.Size, StackManipulation.Trivial
Enum Constant and Description |
---|
FIVE
A JVM-type
int constant of value 5 . |
FOUR
A JVM-type
int constant of value 4 . |
MINUS_ONE
A JVM-type
int constant of value -1 . |
ONE
A JVM-type
int constant of value 1 . |
THREE
A JVM-type
int constant of value 3 . |
TWO
A JVM-type
int constant of value 2 . |
ZERO
A JVM-type
int constant of value 0 . |
Modifier and Type | Method and Description |
---|---|
StackManipulation.Size |
apply(MethodVisitor methodVisitor,
Implementation.Context implementationContext)
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
int
constant of value -1
.public static final IntegerConstant ZERO
int
constant of value 0
.public static final IntegerConstant ONE
int
constant of value 1
.public static final IntegerConstant TWO
int
constant of value 2
.public static final IntegerConstant THREE
int
constant of value 3
.public static final IntegerConstant FOUR
int
constant of value 4
.public static final IntegerConstant FIVE
int
constant of value 5
.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()
isValid
in interface StackManipulation
false
, this manipulation cannot be applied and should throw an exception.public StackManipulation.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext)
apply
in interface StackManipulation
methodVisitor
- The method visitor used to write the method implementation to.implementationContext
- The context of the current implementation.Copyright © 2014–2025. All rights reserved.