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 java.lang.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 Classes Modifier and Type Class Description protected static class
Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter.ForMethodEnter
An advice method writer for a method enter.protected static class
Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter.ForMethodExit
An advice method writer for a method exit.
-
Field Summary
Fields Modifier and Type Field Description protected MethodDescription.InDefinedShape
adviceMethod
The advice method.protected Advice.ArgumentHandler.ForAdvice
argumentHandler
A handler for accessing values on the local variable array.private Assigner
assigner
The assigner to use.private Advice.Delegator
delegator
The delegator to use.protected Implementation.Context
implementationContext
The implementation context to use.private MethodDescription
instrumentedMethod
The instrumented method.private TypeDescription
instrumentedType
The instrumented type.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.private java.util.List<Advice.OffsetMapping.Target>
offsetMappings
The offset mappings available to this advice.private Advice.PostProcessor
postProcessor
The post processor to apply.private Advice.Dispatcher.RelocationHandler.Bound
relocationHandler
A bound relocation handler that is responsible for considering a non-standard control flow.protected Advice.StackMapFrameHandler.ForAdvice
stackMapFrameHandler
A handler for translating and injecting stack map frames.private Advice.Dispatcher.SuppressionHandler.Bound
suppressionHandler
A bound suppression handler that is used for suppressing exceptions of this advice method.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AdviceMethodWriter(MethodDescription.InDefinedShape adviceMethod, TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, Advice.PostProcessor postProcessor, java.util.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, Advice.Delegator delegator)
Creates a new advice method writer.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
apply()
Applies this dispatcher.protected abstract boolean
isExitAdvice()
Returnstrue
if this writer represents exit advice.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.Bound
initialize
-
-
-
-
Field Detail
-
adviceMethod
protected final MethodDescription.InDefinedShape adviceMethod
The advice method.
-
instrumentedType
private final TypeDescription instrumentedType
The instrumented type.
-
instrumentedMethod
private final MethodDescription instrumentedMethod
The instrumented method.
-
assigner
private final Assigner assigner
The assigner to use.
-
offsetMappings
private final java.util.List<Advice.OffsetMapping.Target> offsetMappings
The offset mappings available to this advice.
-
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.
-
argumentHandler
protected final Advice.ArgumentHandler.ForAdvice argumentHandler
A handler for accessing values on the local variable array.
-
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.
-
suppressionHandler
private final Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler
A bound suppression handler that is used for suppressing exceptions of this advice method.
-
relocationHandler
private final Advice.Dispatcher.RelocationHandler.Bound relocationHandler
A bound relocation handler that is responsible for considering a non-standard control flow.
-
postProcessor
private final Advice.PostProcessor postProcessor
The post processor to apply.
-
delegator
private final Advice.Delegator delegator
The delegator to use.
-
-
Constructor Detail
-
AdviceMethodWriter
protected AdviceMethodWriter(MethodDescription.InDefinedShape adviceMethod, TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, Advice.PostProcessor postProcessor, java.util.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, Advice.Delegator delegator)
Creates a new advice method writer.- Parameters:
adviceMethod
- The advice method.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.delegator
- The delegator to use.
-
-
Method Detail
-
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.
-
-