Top Description Inners Fields Constructors Methods
net.bytebuddy.implementation.bytecode.assign.primitive

public final Enum PrimitiveBoxingDelegate

extends Enum<PrimitiveBoxingDelegate>
Class Inheritance
Imports
net.bytebuddy.description.type.TypeDefinition, .TypeDescription, net.bytebuddy.implementation.Implementation, net.bytebuddy.implementation.bytecode.StackManipulation, .StackSize, net.bytebuddy.implementation.bytecode.assign.Assigner, net.bytebuddy.jar.asm.MethodVisitor, .Opcodes

This delegate is responsible for boxing a primitive types to their wrapper equivalents.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
PrimitiveBoxingDelegate.BoxingStackManipulation

A stack manipulation for boxing a primitive type into its wrapper type.

Field Summary

Modifier and TypeField and Description
public static final PrimitiveBoxingDelegate
BOOLEAN

The boxing delegate for boolean values.

private final String
boxingMethodDescriptor

The descriptor of the method for boxing a primitive value as its wrapper type.

private final String
boxingMethodName

The name of the method for boxing a primitive value as its wrapper type.

public static final PrimitiveBoxingDelegate
BYTE

The boxing delegate for byte values.

public static final PrimitiveBoxingDelegate
CHARACTER

The boxing delegate for char values.

public static final PrimitiveBoxingDelegate
DOUBLE

The boxing delegate for double values.

public static final PrimitiveBoxingDelegate
FLOAT

The boxing delegate for float values.

public static final PrimitiveBoxingDelegate
INTEGER

The boxing delegate for int values.

public static final PrimitiveBoxingDelegate
LONG

The boxing delegate for long values.

public static final PrimitiveBoxingDelegate
SHORT

The boxing delegate for short values.

private final StackManipulation.Size
size

The size decrease after a primitive type was wrapped.

private final TypeDescription
wrapperType

A description of a wrapper type.

Constructor Summary

AccessConstructor and Description
private
PrimitiveBoxingDelegate(Class<?>
A description of a wrapper type.
wrapperType
,
StackSize
The size difference between a primitive type and its wrapper type.
sizeDifference
,
String
The name of the method for boxing a primitive value as its wrapper type.
boxingMethodName
,
String
The descriptor of the method for boxing a primitive value as its wrapper type.
boxingMethodDescriptor
)

Creates a new primitive boxing delegate.

Method Summary

Modifier and TypeMethod and Description
public StackManipulation

Returns:

A stack manipulation that represents the described assignment operation.
assignBoxedTo
(TypeDescription.Generic
The type that is target of the assignment operation.
target
,
Assigner
The assigner that is to be used to perform the chained assignment.
chainedAssigner
,
Assigner.Typing
Determines if an assignment to an incompatible type should be enforced by a casting.
typing
)

Creates a stack manipulation that boxes the represented primitive type and applies a chained assignment to the result of this boxing operation.

public static PrimitiveBoxingDelegate

Returns:

A delegate capable of boxing the given primitive type.
forPrimitive
(TypeDefinition
A non-void primitive type.
typeDefinition
)

Locates a boxing delegate for a given primitive type.

public static PrimitiveBoxingDelegate
public static PrimitiveBoxingDelegate[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BOOLEANback to summary
public static final PrimitiveBoxingDelegate BOOLEAN

The boxing delegate for boolean values.

boxingMethodDescriptorback to summary
private final String boxingMethodDescriptor

The descriptor of the method for boxing a primitive value as its wrapper type.

boxingMethodNameback to summary
private final String boxingMethodName

The name of the method for boxing a primitive value as its wrapper type.

BYTEback to summary
public static final PrimitiveBoxingDelegate BYTE

The boxing delegate for byte values.

CHARACTERback to summary
public static final PrimitiveBoxingDelegate CHARACTER

The boxing delegate for char values.

DOUBLEback to summary
public static final PrimitiveBoxingDelegate DOUBLE

The boxing delegate for double values.

FLOATback to summary
public static final PrimitiveBoxingDelegate FLOAT

The boxing delegate for float values.

INTEGERback to summary
public static final PrimitiveBoxingDelegate INTEGER

The boxing delegate for int values.

LONGback to summary
public static final PrimitiveBoxingDelegate LONG

The boxing delegate for long values.

SHORTback to summary
public static final PrimitiveBoxingDelegate SHORT

The boxing delegate for short values.

sizeback to summary
private final StackManipulation.Size size

The size decrease after a primitive type was wrapped.

wrapperTypeback to summary
private final TypeDescription wrapperType

A description of a wrapper type.

Constructor Detail

PrimitiveBoxingDelegateback to summary
private PrimitiveBoxingDelegate(Class<?> wrapperType, StackSize sizeDifference, String boxingMethodName, String boxingMethodDescriptor)

Creates a new primitive boxing delegate.

Parameters
wrapperType:Class<?>

A description of a wrapper type.

sizeDifference:StackSize

The size difference between a primitive type and its wrapper type.

boxingMethodName:String

The name of the method for boxing a primitive value as its wrapper type.

boxingMethodDescriptor:String

The descriptor of the method for boxing a primitive value as its wrapper type.

Method Detail

assignBoxedToback to summary
public StackManipulation assignBoxedTo(TypeDescription.Generic target, Assigner chainedAssigner, Assigner.Typing typing)

Creates a stack manipulation that boxes the represented primitive type and applies a chained assignment to the result of this boxing operation.

Parameters
target:TypeDescription.Generic

The type that is target of the assignment operation.

chainedAssigner:Assigner

The assigner that is to be used to perform the chained assignment.

typing:Assigner.Typing

Determines if an assignment to an incompatible type should be enforced by a casting.

Returns:StackManipulation

A stack manipulation that represents the described assignment operation.

forPrimitiveback to summary
public static PrimitiveBoxingDelegate forPrimitive(TypeDefinition typeDefinition)

Locates a boxing delegate for a given primitive type.

Parameters
typeDefinition:TypeDefinition

A non-void primitive type.

Returns:PrimitiveBoxingDelegate

A delegate capable of boxing the given primitive type.

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

private Class PrimitiveBoxingDelegate.BoxingStackManipulation

extends Object
implements StackManipulation
Class Inheritance
  • java.lang.Object
  • net.bytebuddy.implementation.bytecode.assign.primitive.PrimitiveBoxingDelegate.BoxingStackManipulation
All Implemented Interfaces
net.bytebuddy.implementation.bytecode.StackManipulation

A stack manipulation for boxing a primitive type into its wrapper type.

Field Summary

Modifier and TypeField and Description
private final StackManipulation
stackManipulation

A stack manipulation that is applied after the boxing of the top-most value on the operand stack.

Constructor Summary

AccessConstructor and Description
public
BoxingStackManipulation(StackManipulation
A stack manipulation that is applied after the boxing of the top-most value on the operand stack.
stackManipulation
)

Creates a new boxing stack manipulation.

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 boolean
isValid()

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

Determines if this stack manipulation is valid.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

stackManipulationback to summary
private final StackManipulation stackManipulation

A stack manipulation that is applied after the boxing of the top-most value on the operand stack.

Constructor Detail

BoxingStackManipulationback to summary
public BoxingStackManipulation(StackManipulation stackManipulation)

Creates a new boxing stack manipulation.

Parameters
stackManipulation:StackManipulation

A stack manipulation that is applied after the boxing of the top-most value on 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.

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.