Package jodd.proxetta.asm
Class ProxettaMethodBuilder
- java.lang.Object
-
- jodd.asm9.MethodVisitor
-
- jodd.asm.EmptyMethodVisitor
-
- jodd.proxetta.asm.ProxettaMethodBuilder
-
public class ProxettaMethodBuilder extends EmptyMethodVisitor
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<jodd.proxetta.asm.ProxyAspectData>
aspectList
protected MethodVisitor
methodVisitor
protected MethodSignatureVisitor
msign
protected boolean
proxyInfoRequested
static java.lang.String
TARGET_CLASS_NAME
protected jodd.proxetta.asm.TargetMethodData
tmd
protected WorkData
wd
-
Fields inherited from class jodd.asm9.MethodVisitor
api, mv
-
-
Constructor Summary
Constructors Constructor Description ProxettaMethodBuilder(MethodSignatureVisitor msign, WorkData wd, java.util.List<jodd.proxetta.asm.ProxyAspectData> aspectList)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
createFirstChainDelegate_Continue(jodd.proxetta.asm.TargetMethodData tmd)
Continues the creation of the very first method in calling chain that simply delegates invocation to the first proxy method.protected void
createFirstChainDelegate_Start()
Starts creation of first chain delegate.void
createProxyMethod(jodd.proxetta.asm.TargetMethodData td)
Creates proxy methods over target method, For each matched proxy, new proxy method is created by taking advice bytecode and replaces usages ofProxyTarget
.AnnotationVisitor
visitAnnotation(java.lang.String desc, boolean visible)
Copies target method annotations.AnnotationVisitor
visitAnnotationDefault()
Visits the default value of this annotation interface method.void
visitEnd()
Finally, builds proxy methods if applied to current method.AnnotationVisitor
visitParameterAnnotation(int parameter, java.lang.String desc, boolean visible)
Visits an annotation of a parameter this method.-
Methods inherited from class jodd.asm9.MethodVisitor
visitAnnotableParameterCount, visitAttribute, visitCode, visitFieldInsn, visitFrame, visitIincInsn, visitInsn, visitInsnAnnotation, visitIntInsn, visitInvokeDynamicInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLocalVariableAnnotation, visitLookupSwitchInsn, visitMaxs, visitMethodInsn, visitMethodInsn, visitMultiANewArrayInsn, visitParameter, visitTableSwitchInsn, visitTryCatchAnnotation, visitTryCatchBlock, visitTypeAnnotation, visitTypeInsn, visitVarInsn
-
-
-
-
Field Detail
-
TARGET_CLASS_NAME
public static final java.lang.String TARGET_CLASS_NAME
-
msign
protected final MethodSignatureVisitor msign
-
wd
protected final WorkData wd
-
aspectList
protected final java.util.List<jodd.proxetta.asm.ProxyAspectData> aspectList
-
tmd
protected jodd.proxetta.asm.TargetMethodData tmd
-
methodVisitor
protected MethodVisitor methodVisitor
-
proxyInfoRequested
protected boolean proxyInfoRequested
-
-
Constructor Detail
-
ProxettaMethodBuilder
public ProxettaMethodBuilder(MethodSignatureVisitor msign, WorkData wd, java.util.List<jodd.proxetta.asm.ProxyAspectData> aspectList)
-
-
Method Detail
-
visitAnnotation
public AnnotationVisitor visitAnnotation(java.lang.String desc, boolean visible)
Copies target method annotations.- Overrides:
visitAnnotation
in classMethodVisitor
- Parameters:
desc
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.- Returns:
- a visitor to visit the annotation values, or null if this visitor is not interested in visiting this annotation.
-
visitAnnotationDefault
public AnnotationVisitor visitAnnotationDefault()
Description copied from class:MethodVisitor
Visits the default value of this annotation interface method.- Overrides:
visitAnnotationDefault
in classMethodVisitor
- Returns:
- a visitor to the visit the actual default value of this annotation interface method, or null if this visitor is not interested in visiting this default value. The 'name' parameters passed to the methods of this annotation visitor are ignored. Moreover, exacly one visit method must be called on this annotation visitor, followed by visitEnd.
-
visitParameterAnnotation
public AnnotationVisitor visitParameterAnnotation(int parameter, java.lang.String desc, boolean visible)
Description copied from class:MethodVisitor
Visits an annotation of a parameter this method.- Overrides:
visitParameterAnnotation
in classMethodVisitor
- Parameters:
parameter
- the parameter index. This index must be strictly smaller than the number of parameters in the method descriptor, and strictly smaller than the parameter count specified inMethodVisitor.visitAnnotableParameterCount(int, boolean)
. Important note: a parameter index i is not required to correspond to the i'th parameter descriptor in the method descriptor, in particular in case of synthetic parameters (see https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.18).desc
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.- Returns:
- a visitor to visit the annotation values, or null if this visitor is not interested in visiting this annotation.
-
visitEnd
public void visitEnd()
Finally, builds proxy methods if applied to current method.- Overrides:
visitEnd
in classMethodVisitor
-
createFirstChainDelegate_Start
protected void createFirstChainDelegate_Start()
Starts creation of first chain delegate.
-
createFirstChainDelegate_Continue
protected void createFirstChainDelegate_Continue(jodd.proxetta.asm.TargetMethodData tmd)
Continues the creation of the very first method in calling chain that simply delegates invocation to the first proxy method. This method mirrors the target method.
-
createProxyMethod
public void createProxyMethod(jodd.proxetta.asm.TargetMethodData td)
Creates proxy methods over target method, For each matched proxy, new proxy method is created by taking advice bytecode and replaces usages ofProxyTarget
.Invocation chain example:
name -> name$p0 -> name$p1 -> name$p4 -> super
.
-
-