Package net.bytebuddy.asm
Class Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter
java.lang.Object
net.bytebuddy.asm.Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter
- All Implemented Interfaces:
Advice.Dispatcher.Bound
- Direct Known Subclasses:
Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter.ForMethodEnter
,Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter.ForMethodExit
- Enclosing class:
Advice.Dispatcher.Delegating.Resolved
protected abstract static class Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter
extends Object
implements Advice.Dispatcher.Bound
A bound advice method that copies the code by first extracting the exception table and later appending the
code of the method without copying any meta data.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
An advice method writer for a method enter.protected static class
An advice method writer for a method exit. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Advice.ArgumentHandler.ForAdvice
A handler for accessing values on the local variable array.private final Assigner
The assigner to use.private final Advice.Delegator
The delegator to use.private final StackManipulation
The exception handler that is resolved for the instrumented method.protected final Implementation.Context
The implementation context to use.private final MethodDescription
The instrumented method.private final TypeDescription
The instrumented type.protected final Advice.MethodSizeHandler.ForAdvice
A handler for computing the method size requirements.protected final org.objectweb.asm.MethodVisitor
The method visitor for writing the instrumented method.private final List
<Advice.OffsetMapping.Target> The offset mappings available to this advice.private final Advice.PostProcessor
The post processor to apply.private final Advice.Dispatcher.RelocationHandler.Bound
A bound relocation handler that is responsible for considering a non-standard control flow.protected final Advice.StackMapFrameHandler.ForAdvice
A handler for translating and injecting stack map frames.private final Advice.Dispatcher.SuppressionHandler.Bound
A bound suppression handler that is used for suppressing exceptions of this advice method.protected final MethodDescription.TypeToken
The advice method. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AdviceMethodWriter
(MethodDescription.TypeToken typeToken, TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, Advice.PostProcessor postProcessor, List<Advice.OffsetMapping.Target> offsetMappings, org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Advice.ArgumentHandler.ForAdvice argumentHandler, Advice.MethodSizeHandler.ForAdvice methodSizeHandler, Advice.StackMapFrameHandler.ForAdvice stackMapFrameHandler, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler, Advice.Dispatcher.RelocationHandler.Bound relocationHandler, StackManipulation exceptionHandler, Advice.Delegator delegator) Creates a new advice method writer. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.bytebuddy.asm.Advice.Dispatcher.Bound
initialize
-
Field Details
-
typeToken
The advice method. -
instrumentedType
The instrumented type. -
instrumentedMethod
The instrumented method. -
assigner
The assigner to use. -
offsetMappings
The offset mappings available to this advice. -
methodVisitor
protected final org.objectweb.asm.MethodVisitor methodVisitorThe method visitor for writing the instrumented method. -
implementationContext
The implementation context to use. -
argumentHandler
A handler for accessing values on the local variable array. -
methodSizeHandler
A handler for computing the method size requirements. -
stackMapFrameHandler
A handler for translating and injecting stack map frames. -
suppressionHandler
A bound suppression handler that is used for suppressing exceptions of this advice method. -
relocationHandler
A bound relocation handler that is responsible for considering a non-standard control flow. -
exceptionHandler
The exception handler that is resolved for the instrumented method. -
postProcessor
The post processor to apply. -
delegator
The delegator to use.
-
-
Constructor Details
-
AdviceMethodWriter
protected AdviceMethodWriter(MethodDescription.TypeToken typeToken, TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, Advice.PostProcessor postProcessor, List<Advice.OffsetMapping.Target> offsetMappings, org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Advice.ArgumentHandler.ForAdvice argumentHandler, Advice.MethodSizeHandler.ForAdvice methodSizeHandler, Advice.StackMapFrameHandler.ForAdvice stackMapFrameHandler, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler, Advice.Dispatcher.RelocationHandler.Bound relocationHandler, StackManipulation exceptionHandler, Advice.Delegator delegator) Creates a new advice method writer.- Parameters:
typeToken
- The advice method's type token.instrumentedType
- The instrumented type.instrumentedMethod
- The instrumented method.assigner
- The assigner to use.postProcessor
- The post processor to apply.offsetMappings
- The offset mappings available to this advice.methodVisitor
- The method visitor for writing the instrumented method.implementationContext
- The implementation context to use.argumentHandler
- A handler for accessing values on the local variable array.methodSizeHandler
- A handler for computing the method size requirements.stackMapFrameHandler
- A handler for translating and injecting stack map frames.suppressionHandler
- A bound suppression handler that is used for suppressing exceptions of this advice method.relocationHandler
- A bound relocation handler that is responsible for considering a non-standard control flow.exceptionHandler
- The exception handler that is resolved for the instrumented method.delegator
- The delegator to use.
-
-
Method Details
-
prepare
public void prepare()Prepares the advice method's exception handlers.- Specified by:
prepare
in interfaceAdvice.Dispatcher.Bound
-
apply
public void apply()Applies this dispatcher.- Specified by:
apply
in interfaceAdvice.Dispatcher.Bound
-
isExitAdvice
protected abstract boolean isExitAdvice()Returnstrue
if this writer represents exit advice.- Returns:
true
if this writer represents exit advice.
-