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

public Class TypeCasting

extends AbstractBase
Class Inheritance
Annotations
@Enhance
Imports
net.bytebuddy.build.HashCodeAndEqualsPlugin, net.bytebuddy.description.type.TypeDefinition, .TypeDescription, net.bytebuddy.implementation.Implementation, net.bytebuddy.implementation.bytecode.StackManipulation, .StackSize, net.bytebuddy.jar.asm.MethodVisitor, .Opcodes

A stack manipulation for a type down casting. Such castings are not implicit but must be performed explicitly.

Field Summary

Modifier and TypeField and Description
private final TypeDescription
typeDescription

The type description to which a value should be casted.

Constructor Summary

AccessConstructor and Description
protected
TypeCasting(TypeDescription
The type description to which a value should be casted.
typeDescription
)

Creates a new type casting.

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:

A stack manipulation that represents the casting.
to
(TypeDefinition
The type to which a value should be casted.
typeDefinition
)

Creates a casting to the given, non-primitive type.

Inherited from net.bytebuddy.implementation.bytecode.StackManipulation.AbstractBase:
isValid

Field Detail

typeDescriptionback to summary
private final TypeDescription typeDescription

The type description to which a value should be casted.

Constructor Detail

TypeCastingback to summary
protected TypeCasting(TypeDescription typeDescription)

Creates a new type casting.

Parameters
typeDescription:TypeDescription

The type description to which a value should be casted.

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.

toback to summary
public static StackManipulation to(TypeDefinition typeDefinition)

Creates a casting to the given, non-primitive type.

Parameters
typeDefinition:TypeDefinition

The type to which a value should be casted.

Returns:StackManipulation

A stack manipulation that represents the casting.