Top Description Inners Methods
net.bytebuddy.implementation.bytecode

public Interface ByteCodeAppender

Known Direct Subinterfaces
net.bytebuddy.dynamic.scaffold.TypeInitializer
Known Direct Implementers
net.bytebuddy.implementation.bytecode.ByteCodeAppender.Compound, net.bytebuddy.implementation.bytecode.ByteCodeAppender.Simple, net.bytebuddy.ByteBuddy.EnumerationImplementation.ValuesMethodAppender, net.bytebuddy.ByteBuddy.EnumerationImplementation.InitializationAppender, net.bytebuddy.ByteBuddy.RecordConstructorStrategy.Appender, net.bytebuddy.agent.builder.AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory, net.bytebuddy.agent.builder.AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.ConstructorImplementation.Appender, net.bytebuddy.agent.builder.AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.FactoryImplementation.Appender, net.bytebuddy.agent.builder.AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation.Appender, net.bytebuddy.agent.builder.AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.BridgeMethodImplementation.Appender, net.bytebuddy.asm.Advice.Appender, net.bytebuddy.asm.ClassVisitorFactory.NullCheckedConstruction, net.bytebuddy.asm.ClassVisitorFactory.LabelTranslator, net.bytebuddy.asm.ClassVisitorFactory.LabelArrayTranslator, net.bytebuddy.asm.ClassVisitorFactory.HandleTranslator, net.bytebuddy.asm.ClassVisitorFactory.ConstantDynamicTranslator, net.bytebuddy.asm.ClassVisitorFactory.ConstantTranslator, net.bytebuddy.asm.ClassVisitorFactory.ConstantArrayTranslator, net.bytebuddy.asm.ClassVisitorFactory.FrameTranslator, net.bytebuddy.asm.ClassVisitorFactory.TypePathTranslator, net.bytebuddy.asm.ClassVisitorFactory.AttributeTranslator, net.bytebuddy.build.AccessControllerPlugin.Initializer, net.bytebuddy.dynamic.NexusAccessor.InitializationAppender, net.bytebuddy.dynamic.scaffold.TypeWriter.MethodPool.Record.ForDefinedMethod.OfVisibilityBridge, net.bytebuddy.implementation.DefaultMethodCall.Appender, net.bytebuddy.implementation.EqualsMethod.Appender, net.bytebuddy.implementation.ExceptionMethod, net.bytebuddy.implementation.FieldAccessor.ForImplicitProperty.Appender, net.bytebuddy.implementation.FieldAccessor.ForSetter.Appender, net.bytebuddy.implementation.FixedValue.ForNullValue, net.bytebuddy.implementation.FixedValue.ForOriginType.Appender, net.bytebuddy.implementation.FixedValue.ForThisValue.Appender, net.bytebuddy.implementation.FixedValue.ForArgument, net.bytebuddy.implementation.FixedValue.ForConstantValue, net.bytebuddy.implementation.FixedValue.ForValue.StaticFieldByteCodeAppender, net.bytebuddy.implementation.HashCodeMethod.Appender, net.bytebuddy.implementation.Implementation.Context.Default.DelegationRecord, net.bytebuddy.implementation.Implementation.Simple.ForDispatcher.Appender, net.bytebuddy.implementation.InvocationHandlerAdapter.ForInstance.Appender, net.bytebuddy.implementation.InvocationHandlerAdapter.ForField.Appender, net.bytebuddy.implementation.InvokeDynamic.Appender, net.bytebuddy.implementation.MethodCall.FieldSetting.Appender, net.bytebuddy.implementation.MethodCall.Appender, net.bytebuddy.implementation.MethodDelegation.Appender, net.bytebuddy.implementation.StubMethod, net.bytebuddy.implementation.SuperMethodCall.Appender, net.bytebuddy.implementation.ToStringMethod.Appender, net.bytebuddy.implementation.auxiliary.MethodCallProxy.ConstructorCall.Appender, net.bytebuddy.implementation.auxiliary.MethodCallProxy.MethodCall.Appender, net.bytebuddy.implementation.auxiliary.TypeProxy.SilentConstruction.Appender, net.bytebuddy.implementation.auxiliary.TypeProxy.MethodCall.Appender, net.bytebuddy.implementation.bind.annotation.FieldProxy.Binder.InstanceFieldConstructor.Appender, net.bytebuddy.implementation.bind.annotation.FieldProxy.Binder.FieldGetter.Appender, net.bytebuddy.implementation.bind.annotation.FieldProxy.Binder.FieldSetter.Appender, net.bytebuddy.implementation.bind.annotation.Morph.Binder.RedirectionProxy.InstanceFieldConstructor.Appender, net.bytebuddy.implementation.bind.annotation.Morph.Binder.RedirectionProxy.MethodCall.Appender, net.bytebuddy.implementation.bind.annotation.Pipe.Binder.RedirectionProxy.ConstructorCall.Appender, net.bytebuddy.implementation.bind.annotation.Pipe.Binder.RedirectionProxy.MethodCall.Appender
Imports
net.bytebuddy.build.HashCodeAndEqualsPlugin, net.bytebuddy.description.method.MethodDescription, net.bytebuddy.implementation.Implementation, net.bytebuddy.jar.asm.MethodVisitor, java.util.ArrayList, .Arrays, .List

An appender that generates the byte code for a given method. This is done by writing the byte code instructions to the given ASM net.bytebuddy.jar.asm.MethodVisitor.

 

The ByteCodeAppender is not allowed to write annotations to the method or call the net.bytebuddy.jar.asm.MethodVisitor#visitCode(), net.bytebuddy.jar.asm.MethodVisitor#visitMaxs(int, int) or net.bytebuddy.jar.asm.MethodVisitor#visitEnd() methods which is both done by the entity delegating the call to the ByteCodeAppender. This is done in order to allow for the concatenation of several byte code appenders and therefore a more modular description of method implementations.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ByteCodeAppender.Compound

A compound appender that combines a given number of other byte code appenders.

public static class
ByteCodeAppender.Simple

A simple byte code appender that only represents a given array of StackManipulations.

public static class
ByteCodeAppender.Size

An immutable description of both the operand stack size and the size of the local variable array that is required to run the code generated by this ByteCodeAppender.

Method Summary

Modifier and TypeMethod and Description
public ByteCodeAppender.Size

Returns:

The required size for the applied byte code to run.
apply
(MethodVisitor
The method visitor to which the byte code appender writes its code to.
methodVisitor
,
Implementation.Context
The implementation context of the current type creation process.
implementationContext
,
MethodDescription
The method that is the target of the instrumentation.
instrumentedMethod
)

Applies this byte code appender to a type creation process.

Method Detail

applyback to summary
public ByteCodeAppender.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod)

Applies this byte code appender to a type creation process.

Parameters
methodVisitor:MethodVisitor

The method visitor to which the byte code appender writes its code to.

implementationContext:Implementation.Context

The implementation context of the current type creation process.

instrumentedMethod:MethodDescription

The method that is the target of the instrumentation.

Returns:ByteCodeAppender.Size

The required size for the applied byte code to run.

net.bytebuddy.implementation.bytecode back to summary

public Class ByteCodeAppender.Compound

extends Object
implements ByteCodeAppender
Class Inheritance
  • java.lang.Object
  • net.bytebuddy.implementation.bytecode.ByteCodeAppender.Compound
All Implemented Interfaces
net.bytebuddy.implementation.bytecode.ByteCodeAppender
Annotations
@Enhance

A compound appender that combines a given number of other byte code appenders.

Field Summary

Modifier and TypeField and Description
private final List<ByteCodeAppender>
byteCodeAppenders

The byte code appenders that are represented by this compound appender in their application order.

Constructor Summary

AccessConstructor and Description
public
Compound(ByteCodeAppender...
The byte code appenders to combine in their order.
byteCodeAppender
)

Creates a new compound byte code appender.

public
Compound(List<? extends ByteCodeAppender>
The byte code appenders to combine in their order.
byteCodeAppenders
)

Creates a new compound byte code appender.

Method Summary

Modifier and TypeMethod and Description
public ByteCodeAppender.Size
apply(MethodVisitor
The method visitor to which the byte code appender writes its code to.
methodVisitor
,
Implementation.Context
The implementation context of the current type creation process.
implementationContext
,
MethodDescription
The method that is the target of the instrumentation.
instrumentedMethod
)

Implements net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Applies this byte code appender to a type creation process.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

byteCodeAppendersback to summary
private final List<ByteCodeAppender> byteCodeAppenders

The byte code appenders that are represented by this compound appender in their application order.

Constructor Detail

Compoundback to summary
public Compound(ByteCodeAppender... byteCodeAppender)

Creates a new compound byte code appender.

Parameters
byteCodeAppender:ByteCodeAppender[]

The byte code appenders to combine in their order.

Compoundback to summary
public Compound(List<? extends ByteCodeAppender> byteCodeAppenders)

Creates a new compound byte code appender.

Parameters
byteCodeAppenders:List<? extends ByteCodeAppender>

The byte code appenders to combine in their order.

Method Detail

applyback to summary
public ByteCodeAppender.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod)

Implements net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

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

Applies this byte code appender to a type creation process.

Parameters
methodVisitor:MethodVisitor

The method visitor to which the byte code appender writes its code to.

implementationContext:Implementation.Context

The implementation context of the current type creation process.

instrumentedMethod:MethodDescription

The method that is the target of the instrumentation.

Returns:ByteCodeAppender.Size

The required size for the applied byte code to run.

net.bytebuddy.implementation.bytecode back to summary

public Class ByteCodeAppender.Simple

extends Object
implements ByteCodeAppender
Class Inheritance
  • java.lang.Object
  • net.bytebuddy.implementation.bytecode.ByteCodeAppender.Simple
All Implemented Interfaces
net.bytebuddy.implementation.bytecode.ByteCodeAppender
Annotations
@Enhance

A simple byte code appender that only represents a given array of StackManipulations.

Field Summary

Modifier and TypeField and Description
private final StackManipulation
stackManipulation

A compound stack manipulation to be applied for this byte code appender.

Constructor Summary

AccessConstructor and Description
public
Simple(StackManipulation...
The stack manipulations to apply for this byte code appender in their application order.
stackManipulation
)

Creates a new simple byte code appender which represents the given stack manipulation.

public
Simple(List<? extends StackManipulation>
The stack manipulations to apply for this byte code appender in their application order.
stackManipulations
)

Creates a new simple byte code appender which represents the given stack manipulation.

Method Summary

Modifier and TypeMethod and Description
public ByteCodeAppender.Size
apply(MethodVisitor
The method visitor to which the byte code appender writes its code to.
methodVisitor
,
Implementation.Context
The implementation context of the current type creation process.
implementationContext
,
MethodDescription
The method that is the target of the instrumentation.
instrumentedMethod
)

Implements net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Applies this byte code appender to a type creation process.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

stackManipulationback to summary
private final StackManipulation stackManipulation

A compound stack manipulation to be applied for this byte code appender.

Constructor Detail

Simpleback to summary
public Simple(StackManipulation... stackManipulation)

Creates a new simple byte code appender which represents the given stack manipulation.

Parameters
stackManipulation:StackManipulation[]

The stack manipulations to apply for this byte code appender in their application order.

Simpleback to summary
public Simple(List<? extends StackManipulation> stackManipulations)

Creates a new simple byte code appender which represents the given stack manipulation.

Parameters
stackManipulations:List<? extends StackManipulation>

The stack manipulations to apply for this byte code appender in their application order.

Method Detail

applyback to summary
public ByteCodeAppender.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod)

Implements net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

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

Applies this byte code appender to a type creation process.

Parameters
methodVisitor:MethodVisitor

The method visitor to which the byte code appender writes its code to.

implementationContext:Implementation.Context

The implementation context of the current type creation process.

instrumentedMethod:MethodDescription

The method that is the target of the instrumentation.

Returns:ByteCodeAppender.Size

The required size for the applied byte code to run.

net.bytebuddy.implementation.bytecode back to summary

public Class ByteCodeAppender.Size

extends Object
Class Inheritance
Annotations
@Enhance

An immutable description of both the operand stack size and the size of the local variable array that is required to run the code generated by this ByteCodeAppender.

Field Summary

Modifier and TypeField and Description
private final int
localVariableSize

The size of the local variable array.

private final int
operandStackSize

The size of the operand stack.

public static final ByteCodeAppender.Size
ZERO

A size of zero.

Constructor Summary

AccessConstructor and Description
public
Size(int
The operand stack size that is required for running given byte code.
operandStackSize
,
int
The local variable array size that is required for running given byte code.
localVariableSize
)

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The required size of the local variable array.
getLocalVariableSize
()

Returns the required size of the local variable array.

public int

Returns:

The required operand stack size.
getOperandStackSize
()

Returns the required operand stack size.

public ByteCodeAppender.Size

Returns:

A size description incorporating both size requirements.
merge
(ByteCodeAppender.Size
The other size description.
other
)

Merges two sizes in order to describe the size that is required by both size descriptions.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

localVariableSizeback to summary
private final int localVariableSize

The size of the local variable array.

operandStackSizeback to summary
private final int operandStackSize

The size of the operand stack.

ZEROback to summary
public static final ByteCodeAppender.Size ZERO

A size of zero.

Constructor Detail

Sizeback to summary
public Size(int operandStackSize, int localVariableSize)
Parameters
operandStackSize:int

The operand stack size that is required for running given byte code.

localVariableSize:int

The local variable array size that is required for running given byte code.

Method Detail

getLocalVariableSizeback to summary
public int getLocalVariableSize()

Returns the required size of the local variable array.

Returns:int

The required size of the local variable array.

getOperandStackSizeback to summary
public int getOperandStackSize()

Returns the required operand stack size.

Returns:int

The required operand stack size.

mergeback to summary
public ByteCodeAppender.Size merge(ByteCodeAppender.Size other)

Merges two sizes in order to describe the size that is required by both size descriptions.

Parameters
other:ByteCodeAppender.Size

The other size description.

Returns:ByteCodeAppender.Size

A size description incorporating both size requirements.