Interface ByteCodeAppender

All Known Subinterfaces:
TypeInitializer
All Known Implementing Classes:
AccessControllerPlugin.Initializer, AccessControllerPlugin.Initializer.WithoutProperty, AccessControllerPlugin.Initializer.WithProperty, Advice.Appender, AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.BridgeMethodImplementation.Appender, AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.ConstructorImplementation.Appender, AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.FactoryImplementation.Appender, AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation.Appender, AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory, ByteBuddy.EnumerationImplementation.InitializationAppender, ByteBuddy.EnumerationImplementation.ValuesMethodAppender, ByteBuddy.RecordConstructorStrategy.Appender, ByteCodeAppender.Compound, ByteCodeAppender.Simple, DefaultMethodCall.Appender, EqualsMethod.Appender, ExceptionMethod, FieldAccessor.ForImplicitProperty.Appender, FieldAccessor.ForSetter.Appender, FieldProxy.Binder.FieldGetter.Appender, FieldProxy.Binder.FieldSetter.Appender, FieldProxy.Binder.InstanceFieldConstructor.Appender, FixedValue.ForArgument, FixedValue.ForNullValue, FixedValue.ForOriginType.Appender, FixedValue.ForPoolValue, FixedValue.ForThisValue.Appender, FixedValue.ForValue.StaticFieldByteCodeAppender, HashCodeMethod.Appender, Implementation.Context.Default.AccessorMethodDelegation, Implementation.Context.Default.DelegationRecord, Implementation.Context.Default.FieldGetterDelegation, Implementation.Context.Default.FieldSetterDelegation, Implementation.Simple.ForDispatcher.Appender, InvocationHandlerAdapter.ForField.Appender, InvocationHandlerAdapter.ForInstance.Appender, InvokeDynamic.Appender, MethodCall.Appender, MethodCall.FieldSetting.Appender, MethodCallProxy.ConstructorCall.Appender, MethodCallProxy.MethodCall.Appender, MethodDelegation.Appender, Morph.Binder.RedirectionProxy.InstanceFieldConstructor.Appender, Morph.Binder.RedirectionProxy.MethodCall.Appender, NexusAccessor.InitializationAppender, Pipe.Binder.RedirectionProxy.ConstructorCall.Appender, Pipe.Binder.RedirectionProxy.MethodCall.Appender, StubMethod, SuperMethodCall.Appender, ToStringMethod.Appender, TypeInitializer.None, TypeInitializer.Simple, TypeProxy.MethodCall.Appender, TypeProxy.SilentConstruction.Appender, TypeWriter.MethodPool.Record.ForDefinedMethod.OfVisibilityBridge

public interface ByteCodeAppender
An appender that generates the byte code for a given method. This is done by writing the byte code instructions to the given ASM MethodVisitor.

 

The ByteCodeAppender is not allowed to write annotations to the method or call the MethodVisitor.visitCode(), MethodVisitor.visitMaxs(int, int) or 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 Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    A compound appender that combines a given number of other byte code appenders.
    static class 
    A simple byte code appender that only represents a given array of StackManipulations.
    static class 
    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 Type
    Method
    Description
    apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod)
    Applies this byte code appender to a type creation process.
  • Method Details

    • apply

      ByteCodeAppender.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod)
      Applies this byte code appender to a type creation process.
      Parameters:
      methodVisitor - The method visitor to which the byte code appender writes its code to.
      implementationContext - The implementation context of the current type creation process.
      instrumentedMethod - The method that is the target of the instrumentation.
      Returns:
      The required size for the applied byte code to run.