Top Description Inners Fields Constructors Methods
net.bytebuddy.implementation.bytecode.constant

public final Enum IntegerConstant

extends Enum<IntegerConstant>
implements StackManipulation
Class Inheritance
All Implemented Interfaces
net.bytebuddy.implementation.bytecode.StackManipulation
Imports
net.bytebuddy.build.HashCodeAndEqualsPlugin, net.bytebuddy.implementation.Implementation, net.bytebuddy.implementation.bytecode.StackManipulation, .StackSize, net.bytebuddy.jar.asm.MethodVisitor, .Opcodes

This class is responsible for loading any 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.

Nested and Inner Type Summary

Modifier and TypeClass 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.

Field Summary

Modifier and TypeField and Description
public static final IntegerConstant
FIVE

A JVM-type int constant of value 5.

public static final IntegerConstant
FOUR

A JVM-type int constant of value 4.

public static final IntegerConstant
MINUS_ONE

A JVM-type int constant of value -1.

public static final IntegerConstant
ONE

A JVM-type int constant of value 1.

private final int
opcode

The shortcut opcode for loading a common int-compatible JVM value onto the operand stack.

private static final StackManipulation.Size
SIZE

The size impact of loading an int value onto the operand stack.

public static final IntegerConstant
THREE

A JVM-type int constant of value 3.

public static final IntegerConstant
TWO

A JVM-type int constant of value 2.

public static final IntegerConstant
ZERO

A JVM-type int constant of value 0.

Constructor Summary

AccessConstructor and Description
private
IntegerConstant(int
The shortcut opcode for loading a common int-compatible JVM value onto the operand stack.
opcode
)

Creates a new JVM-integer constant loading stack manipulation for a given shortcut opcode.

Method Summary

Modifier and TypeMethod and Description
public StackManipulation.Size
apply(MethodVisitor
The method visitor used to write the method implementation to.
methodVisitor
,
Implementation.Context
The context of the current implementation.
implementationContext
)

Implements net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Applies the stack manipulation that is described by this instance.
public static StackManipulation

Returns:

The stack manipulation for loading this boolean.
forValue
(boolean
The boolean to load onto the stack.
value
)

Creates a stack manipulation for loading a boolean value onto the stack.

public static StackManipulation

Returns:

A stack manipulation for loading the given value.
forValue
(int
The int (or byte, short, char) value to load onto the stack.
value
)

Creates a stack manipulation for loading an int value onto the stack.

public boolean
isValid()

Implements net.bytebuddy.implementation.bytecode.StackManipulation.isValid.

Determines if this stack manipulation is valid.
public static IntegerConstant
public static IntegerConstant[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

FIVEback to summary
public static final IntegerConstant FIVE

A JVM-type int constant of value 5.

FOURback to summary
public static final IntegerConstant FOUR

A JVM-type int constant of value 4.

MINUS_ONEback to summary
public static final IntegerConstant MINUS_ONE

A JVM-type int constant of value -1.

ONEback to summary
public static final IntegerConstant ONE

A JVM-type int constant of value 1.

opcodeback to summary
private final int opcode

The shortcut opcode for loading a common int-compatible JVM value onto the operand stack.

SIZEback to summary
private static final StackManipulation.Size SIZE

The size impact of loading an int value onto the operand stack.

THREEback to summary
public static final IntegerConstant THREE

A JVM-type int constant of value 3.

TWOback to summary
public static final IntegerConstant TWO

A JVM-type int constant of value 2.

ZEROback to summary
public static final IntegerConstant ZERO

A JVM-type int constant of value 0.

Constructor Detail

IntegerConstantback to summary
private IntegerConstant(int opcode)

Creates a new JVM-integer constant loading stack manipulation for a given shortcut opcode.

Parameters
opcode:int

The shortcut opcode for loading a common int-compatible JVM value onto the operand stack.

Method Detail

applyback to summary
public StackManipulation.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext)

Implements net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Doc from net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Applies the stack manipulation that is described by this instance.

Parameters
methodVisitor:MethodVisitor

The method visitor used to write the method implementation to.

implementationContext:Implementation.Context

The context of the current implementation.

Returns:StackManipulation.Size

The changes to the size of the operand stack that are implied by this stack manipulation.

forValueback to summary
public static StackManipulation forValue(boolean value)

Creates a stack manipulation for loading a boolean value onto the stack.

Parameters
value:boolean

The boolean to load onto the stack.

Returns:StackManipulation

The stack manipulation for loading this boolean.

forValueback to summary
public static StackManipulation forValue(int value)

Creates a stack manipulation for loading an int value onto the stack.

 

This is achieved either by invoking a constant opcode, if any, or by creating a binary push operation.
Parameters
value:int

The int (or byte, short, char) value to load onto the stack.

Returns:StackManipulation

A stack manipulation for loading the given value.

isValidback to summary
public boolean isValid()

Implements net.bytebuddy.implementation.bytecode.StackManipulation.isValid.

Doc from net.bytebuddy.implementation.bytecode.StackManipulation.isValid.

Determines if this stack manipulation is valid.

Returns:boolean

If false, this manipulation cannot be applied and should throw an exception.

valueOfback to summary
public static IntegerConstant valueOf(String name)
valuesback to summary
public static IntegerConstant[] values()
net.bytebuddy.implementation.bytecode.constant back to summary

protected Class IntegerConstant.ConstantPool

extends AbstractBase
Class Inheritance
Annotations
@Enhance

A stack manipulation that loads a JVM-integer value from a constant pool value onto the operand stack.

Field Summary

Modifier and TypeField and Description
private final int
value

The JVM-integer value to load onto the operand stack.

Constructor Summary

AccessConstructor and Description
protected
ConstantPool(int
The JVM-integer value to load onto the operand stack.
value
)

Creates a new constant pool loading operation for a given JVM-integer.

Method Summary

Modifier and TypeMethod and Description
public StackManipulation.Size
apply(MethodVisitor
The method visitor used to write the method implementation to.
methodVisitor
,
Implementation.Context
The context of the current implementation.
implementationContext
)

Implements net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Applies the stack manipulation that is described by this instance.
Inherited from net.bytebuddy.implementation.bytecode.StackManipulation.AbstractBase:
isValid

Field Detail

valueback to summary
private final int value

The JVM-integer value to load onto the operand stack.

Constructor Detail

ConstantPoolback to summary
protected ConstantPool(int value)

Creates a new constant pool loading operation for a given JVM-integer.

Parameters
value:int

The JVM-integer value to load onto the operand stack.

Method Detail

applyback to summary
public StackManipulation.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext)

Implements net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Doc from net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Applies the stack manipulation that is described by this instance.

Parameters
methodVisitor:MethodVisitor

The method visitor used to write the method implementation to.

implementationContext:Implementation.Context

The context of the current implementation.

Returns:StackManipulation.Size

The changes to the size of the operand stack that are implied by this stack manipulation.

net.bytebuddy.implementation.bytecode.constant back to summary

protected Class IntegerConstant.SingleBytePush

extends AbstractBase
Class Inheritance
Annotations
@Enhance

A stack manipulation that loads a JVM-integer value by a BIPUSH operation which is legal for single byte integer values.

Field Summary

Modifier and TypeField and Description
private final byte
value

The single byte value to be loaded onto the operand stack.

Constructor Summary

AccessConstructor and Description
protected
SingleBytePush(byte
The single byte value to be loaded onto the operand stack.
value
)

Creates a new BIPUSH stack manipulation for the given value.

Method Summary

Modifier and TypeMethod and Description
public StackManipulation.Size
apply(MethodVisitor
The method visitor used to write the method implementation to.
methodVisitor
,
Implementation.Context
The context of the current implementation.
implementationContext
)

Implements net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Applies the stack manipulation that is described by this instance.
Inherited from net.bytebuddy.implementation.bytecode.StackManipulation.AbstractBase:
isValid

Field Detail

valueback to summary
private final byte value

The single byte value to be loaded onto the operand stack.

Constructor Detail

SingleBytePushback to summary
protected SingleBytePush(byte value)

Creates a new BIPUSH stack manipulation for the given value.

Parameters
value:byte

The single byte value to be loaded onto the operand stack.

Method Detail

applyback to summary
public StackManipulation.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext)

Implements net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Doc from net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Applies the stack manipulation that is described by this instance.

Parameters
methodVisitor:MethodVisitor

The method visitor used to write the method implementation to.

implementationContext:Implementation.Context

The context of the current implementation.

Returns:StackManipulation.Size

The changes to the size of the operand stack that are implied by this stack manipulation.

net.bytebuddy.implementation.bytecode.constant back to summary

protected Class IntegerConstant.TwoBytePush

extends AbstractBase
Class Inheritance
Annotations
@Enhance

A stack manipulation that loads a JVM-integer value by a SIPUSH operation which is legal for up to two byte integer values.

Field Summary

Modifier and TypeField and Description
private final short
value

The two byte value to be loaded onto the operand stack.

Constructor Summary

AccessConstructor and Description
protected
TwoBytePush(short
The two byte value to be loaded onto the operand stack.
value
)

Creates a new SIPUSH stack manipulation for the given value.

Method Summary

Modifier and TypeMethod and Description
public StackManipulation.Size
apply(MethodVisitor
The method visitor used to write the method implementation to.
methodVisitor
,
Implementation.Context
The context of the current implementation.
implementationContext
)

Implements net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Applies the stack manipulation that is described by this instance.
Inherited from net.bytebuddy.implementation.bytecode.StackManipulation.AbstractBase:
isValid

Field Detail

valueback to summary
private final short value

The two byte value to be loaded onto the operand stack.

Constructor Detail

TwoBytePushback to summary
protected TwoBytePush(short value)

Creates a new SIPUSH stack manipulation for the given value.

Parameters
value:short

The two byte value to be loaded onto the operand stack.

Method Detail

applyback to summary
public StackManipulation.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext)

Implements net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Doc from net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Applies the stack manipulation that is described by this instance.

Parameters
methodVisitor:MethodVisitor

The method visitor used to write the method implementation to.

implementationContext:Implementation.Context

The context of the current implementation.

Returns:StackManipulation.Size

The changes to the size of the operand stack that are implied by this stack manipulation.