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

public Class JavaConstantValue

extends AbstractBase
Class Inheritance
Annotations
@Enhance
Imports
net.bytebuddy.build.HashCodeAndEqualsPlugin, net.bytebuddy.description.type.TypeDescription, net.bytebuddy.implementation.Implementation, net.bytebuddy.implementation.bytecode.StackManipulation, net.bytebuddy.utility.ConstantValue, .JavaConstant, net.bytebuddy.jar.asm.ConstantDynamic, .Handle, .MethodVisitor, .Type

A constant representing a JavaConstant. By using this stack manipulation, a value is always represented as a constant pool value and no attempt is made to load the value via a specialized byte code instruction, in contrast to using ConstantValue#toStackManipulation().

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
JavaConstantValue.Visitor

A visitor to resolve a JavaConstant to a ASM constant pool representation.

Field Summary

Modifier and TypeField and Description
private final JavaConstant
constant

The instance to load onto the operand stack.

Constructor Summary

AccessConstructor and Description
public
JavaConstantValue(JavaConstant
The instance to load onto the operand stack.
constant
)

Creates a constant pool value representing a JavaConstant.

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

constantback to summary
private final JavaConstant constant

The instance to load onto the operand stack.

Constructor Detail

JavaConstantValueback to summary
public JavaConstantValue(JavaConstant constant)

Creates a constant pool value representing a JavaConstant.

Parameters
constant:JavaConstant

The instance 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

public final Enum JavaConstantValue.Visitor

extends Enum<JavaConstantValue.Visitor>
implements JavaConstant.Visitor<Object>
Class Inheritance
All Implemented Interfaces
net.bytebuddy.utility.JavaConstant.Visitor

A visitor to resolve a JavaConstant to a ASM constant pool representation.

Field Summary

Modifier and TypeField and Description
public static final JavaConstantValue.Visitor
INSTANCE

The singleton instance.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public ConstantDynamic
onDynamic(JavaConstant.Dynamic
The dynamic constant.
constant
)

Implements net.bytebuddy.utility.JavaConstant.Visitor.onDynamic.

Invoked on a Dynamic constant.
public Handle
onMethodHandle(JavaConstant.MethodHandle
The method handle constant.
constant
)

Implements net.bytebuddy.utility.JavaConstant.Visitor.onMethodHandle.

Invoked on a constant that represents a MethodHandle.
public Type
onMethodType(JavaConstant.MethodType
The method type constant.
constant
)

Implements net.bytebuddy.utility.JavaConstant.Visitor.onMethodType.

Invoked on a constant that represents a MethodType.
public Type
onType(JavaConstant.Simple<TypeDescription>
The simple constant.
constant
)

Implements net.bytebuddy.utility.JavaConstant.Visitor.onType.

Invoked on a Simple constant that represents a TypeDescription.
public Object
onValue(JavaConstant.Simple<?>
The simple constant.
constant
)

Implements net.bytebuddy.utility.JavaConstant.Visitor.onValue.

Invoked on a Simple constant that represents itself.
public static JavaConstantValue.Visitor
public static JavaConstantValue.Visitor[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

INSTANCEback to summary
public static final JavaConstantValue.Visitor INSTANCE

The singleton instance.

Constructor Detail

Visitorback to summary
private Visitor()

Method Detail

onDynamicback to summary
public ConstantDynamic onDynamic(JavaConstant.Dynamic constant)

Implements net.bytebuddy.utility.JavaConstant.Visitor.onDynamic.

Doc from net.bytebuddy.utility.JavaConstant.Visitor.onDynamic.

Invoked on a Dynamic constant.

Parameters
constant:JavaConstant.Dynamic

The dynamic constant.

Returns:ConstantDynamic

The returned value.

onMethodHandleback to summary
public Handle onMethodHandle(JavaConstant.MethodHandle constant)

Implements net.bytebuddy.utility.JavaConstant.Visitor.onMethodHandle.

Doc from net.bytebuddy.utility.JavaConstant.Visitor.onMethodHandle.

Invoked on a constant that represents a MethodHandle.

Parameters
constant:JavaConstant.MethodHandle

The method handle constant.

Returns:Handle

The returned value.

onMethodTypeback to summary
public Type onMethodType(JavaConstant.MethodType constant)

Implements net.bytebuddy.utility.JavaConstant.Visitor.onMethodType.

Doc from net.bytebuddy.utility.JavaConstant.Visitor.onMethodType.

Invoked on a constant that represents a MethodType.

Parameters
constant:JavaConstant.MethodType

The method type constant.

Returns:Type

The returned value.

onTypeback to summary
public Type onType(JavaConstant.Simple<TypeDescription> constant)

Implements net.bytebuddy.utility.JavaConstant.Visitor.onType.

Doc from net.bytebuddy.utility.JavaConstant.Visitor.onType.

Invoked on a Simple constant that represents a TypeDescription.

Parameters
constant:JavaConstant.Simple<TypeDescription>

The simple constant.

Returns:Type

The returned value.

onValueback to summary
public Object onValue(JavaConstant.Simple<?> constant)

Implements net.bytebuddy.utility.JavaConstant.Visitor.onValue.

Doc from net.bytebuddy.utility.JavaConstant.Visitor.onValue.

Invoked on a Simple constant that represents itself. Such values are of type Integer, Long, Float, Double or String.

Parameters
constant:JavaConstant.Simple<?>

The simple constant.

Returns:Object

The returned value.

valueOfback to summary
public static JavaConstantValue.Visitor valueOf(String name)
valuesback to summary
public static JavaConstantValue.Visitor[] values()