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
,Advice.Dispatcher.SuppressionHandler.ReturnValueProducer
- Direct Known Subclasses:
Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter.ForMethodEnter
,Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter.ForMethodExit
- Enclosing class:
- Advice.Dispatcher.Delegating.Resolved<T extends Advice.Dispatcher.Bound>
protected abstract static class Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter extends java.lang.Object implements Advice.Dispatcher.Bound, Advice.Dispatcher.SuppressionHandler.ReturnValueProducer
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 Classes Modifier and Type Class Description protected static class
Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter.ForMethodEnter
An advice method writer for a method entry.protected static class
Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter.ForMethodExit
An advice method writer for a method exit.-
Nested classes/interfaces inherited from interface net.bytebuddy.asm.Advice.Dispatcher.Bound
Advice.Dispatcher.Bound.SkipHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected MethodDescription.InDefinedShape
adviceMethod
The advice method.protected Implementation.Context
implementationContext
The implementation context to use.protected MethodDescription
instrumentedMethod
The instrumented method.protected Advice.MethodSizeHandler.ForAdvice
methodSizeHandler
A handler for computing the method size requirements.protected org.objectweb.asm.MethodVisitor
methodVisitor
The method visitor for writing the instrumented method.protected Advice.StackMapFrameHandler.ForAdvice
stackMapFrameHandler
A handler for translating and injecting stack map frames.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AdviceMethodWriter(MethodDescription.InDefinedShape adviceMethod, MethodDescription instrumentedMethod, java.util.List<Advice.OffsetMapping.Target> offsetMappings, org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Advice.MethodSizeHandler.ForAdvice methodSizeHandler, Advice.StackMapFrameHandler.ForAdvice stackMapFrameHandler, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler)
Creates a new advice method writer.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
doApply()
Writes the advice method invocation.protected abstract void
onMethodReturn()
Invoked directly after the advice method was called.void
prepare()
Prepares the advice method's exception handlers.-
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.SuppressionHandler.ReturnValueProducer
onDefaultValue
-
-
-
-
Field Detail
-
adviceMethod
protected final MethodDescription.InDefinedShape adviceMethod
The advice method.
-
instrumentedMethod
protected final MethodDescription instrumentedMethod
The instrumented method.
-
methodVisitor
protected final org.objectweb.asm.MethodVisitor methodVisitor
The method visitor for writing the instrumented method.
-
implementationContext
protected final Implementation.Context implementationContext
The implementation context to use.
-
methodSizeHandler
protected final Advice.MethodSizeHandler.ForAdvice methodSizeHandler
A handler for computing the method size requirements.
-
stackMapFrameHandler
protected final Advice.StackMapFrameHandler.ForAdvice stackMapFrameHandler
A handler for translating and injecting stack map frames.
-
-
Constructor Detail
-
AdviceMethodWriter
protected AdviceMethodWriter(MethodDescription.InDefinedShape adviceMethod, MethodDescription instrumentedMethod, java.util.List<Advice.OffsetMapping.Target> offsetMappings, org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Advice.MethodSizeHandler.ForAdvice methodSizeHandler, Advice.StackMapFrameHandler.ForAdvice stackMapFrameHandler, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler)
Creates a new advice method writer.- Parameters:
adviceMethod
- The advice method.instrumentedMethod
- The instrumented method.offsetMappings
- The offset mappings available to this advice.methodVisitor
- The method visitor for writing the instrumented method.implementationContext
- The implementation context to use.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.
-
-
Method Detail
-
prepare
public void prepare()
Description copied from interface:Advice.Dispatcher.Bound
Prepares the advice method's exception handlers.- Specified by:
prepare
in interfaceAdvice.Dispatcher.Bound
-
doApply
protected void doApply()
Writes the advice method invocation.
-
onMethodReturn
protected abstract void onMethodReturn()
Invoked directly after the advice method was called.
-
-