Package net.bytebuddy.agent.builder
Class AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation.Appender
java.lang.Object
net.bytebuddy.agent.builder.AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation.Appender
- All Implemented Interfaces:
ByteCodeAppender
- Enclosing class:
AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation
@Enhance
protected static class AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation.Appender
extends Object
implements ByteCodeAppender
An appender for a lambda expression's functional method.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interface
A dispatcher for a lambda expression's implementation.Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bytecode.ByteCodeAppender
ByteCodeAppender.Compound, ByteCodeAppender.Simple, ByteCodeAppender.Size
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<FieldDescription.InDefinedShape> The instrumented type's declared fields.private final AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation.Appender.Dispatcher
The dispatcher to use.private static final AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation.Appender.Dispatcher
A dispatcher using method handle lookup data, if available.private final JavaConstant.MethodType
The specialized type of the lambda method.private final MethodDescription
The target method of the lambda expression. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Appender
(MethodDescription targetMethod, JavaConstant.MethodType specializedLambdaMethod, List<FieldDescription.InDefinedShape> declaredFields, AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation.Appender.Dispatcher dispatcher) Creates an appender of a lambda expression's functional method. -
Method Summary
Modifier and TypeMethodDescriptionapply
(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod) Applies this byte code appender to a type creation process.private static AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation.Appender.Dispatcher
Resolves the dispatcher to use for special method invocations.protected static ByteCodeAppender
of
(MethodDescription targetMethod, JavaConstant.MethodType specializedLambdaMethod, List<FieldDescription.InDefinedShape> declaredFields, JavaConstant.MethodHandle.HandleType handleType, TypeDescription targetType) Resolves an appropriate appender for this lambda expression.
-
Field Details
-
LOOKUP_DATA_DISPATCHER
private static final AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation.Appender.Dispatcher LOOKUP_DATA_DISPATCHERA dispatcher using method handle lookup data, if available. -
targetMethod
The target method of the lambda expression. -
specializedLambdaMethod
The specialized type of the lambda method. -
declaredFields
The instrumented type's declared fields. -
dispatcher
private final AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation.Appender.Dispatcher dispatcherThe dispatcher to use.
-
-
Constructor Details
-
Appender
protected Appender(MethodDescription targetMethod, JavaConstant.MethodType specializedLambdaMethod, List<FieldDescription.InDefinedShape> declaredFields, AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation.Appender.Dispatcher dispatcher) Creates an appender of a lambda expression's functional method.- Parameters:
targetMethod
- The target method of the lambda expression.specializedLambdaMethod
- The specialized type of the lambda method.declaredFields
- The instrumented type's declared fields.dispatcher
- The dispatcher to use.
-
-
Method Details
-
dispatcher
private static AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory.LambdaMethodImplementation.Appender.Dispatcher dispatcher()Resolves the dispatcher to use for special method invocations.- Returns:
- An appropriate dispatcher for the current VM.
-
of
protected static ByteCodeAppender of(MethodDescription targetMethod, JavaConstant.MethodType specializedLambdaMethod, List<FieldDescription.InDefinedShape> declaredFields, JavaConstant.MethodHandle.HandleType handleType, TypeDescription targetType) Resolves an appropriate appender for this lambda expression.- Parameters:
targetMethod
- The target method of the lambda expression.specializedLambdaMethod
- The specialized type of the lambda method.declaredFields
- The instrumented type's declared fields.handleType
- The handle type of the lambda expression's method handle.targetType
- The target type that defines the lambda expression.- Returns:
- An appropriate byte code appender.
-
apply
public ByteCodeAppender.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod) Applies this byte code appender to a type creation process.- Specified by:
apply
in interfaceByteCodeAppender
- 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.
-