|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.objectweb.asm.MethodAdapter
org.objectweb.asm.commons.LocalVariablesSorter
org.objectweb.asm.commons.GeneratorAdapter
org.objectweb.asm.commons.AdviceAdapter
A MethodAdapter to dispatch method body instruction
The behavior is like this:
| Field Summary | |
protected int |
methodAccess
|
protected String |
methodDesc
|
| Fields inherited from class org.objectweb.asm.commons.GeneratorAdapter |
ADD, AND, DIV, EQ, GE, GT, LE, LT, MUL, NE, NEG, OR, REM, SHL, SHR, SUB, USHR, XOR |
| Fields inherited from class org.objectweb.asm.commons.LocalVariablesSorter |
firstLocal |
| Fields inherited from class org.objectweb.asm.MethodAdapter |
mv |
| Constructor Summary | |
AdviceAdapter(MethodVisitor mv,
int access,
String name,
String desc)
Creates a new AdviceAdapter. |
|
| Method Summary | |
protected abstract void |
onMethodEnter()
Called at the beginning of the method or after super class class call in the constructor. |
protected abstract void |
onMethodExit(int opcode)
Called before explicit exit from the method using either return or throw. |
void |
visitFieldInsn(int opcode,
String owner,
String name,
String desc)
Visits a field instruction. |
void |
visitInsn(int opcode)
Visits a zero operand instruction. |
void |
visitIntInsn(int opcode,
int operand)
Visits an instruction with a single int operand. |
void |
visitJumpInsn(int opcode,
Label label)
Visits a jump instruction. |
void |
visitLabel(Label label)
Visits a label. |
void |
visitLdcInsn(Object cst)
Visits a LDC instruction. |
void |
visitLookupSwitchInsn(Label dflt,
int[] keys,
Label[] labels)
Visits a LOOKUPSWITCH instruction. |
void |
visitMethodInsn(int opcode,
String owner,
String name,
String desc)
Visits a method instruction. |
void |
visitMultiANewArrayInsn(String desc,
int dims)
Visits a MULTIANEWARRAY instruction. |
void |
visitTableSwitchInsn(int min,
int max,
Label dflt,
Label[] labels)
Visits a TABLESWITCH instruction. |
void |
visitTypeInsn(int opcode,
String name)
Visits a type instruction. |
void |
visitVarInsn(int opcode,
int var)
Visits a local variable instruction. |
| Methods inherited from class org.objectweb.asm.commons.GeneratorAdapter |
arrayLength, arrayLoad, arrayStore, box, cast, catchException, checkCast, dup, dup2, dup2X1, dup2X2, dupX1, dupX2, endMethod, getField, getLocalType, getStatic, goTo, ifCmp, ifICmp, ifNonNull, ifNull, ifZCmp, iinc, instanceOf, invokeConstructor, invokeInterface, invokeStatic, invokeVirtual, loadArg, loadArgArray, loadArgs, loadArgs, loadLocal, loadLocal, loadThis, mark, mark, math, monitorEnter, monitorExit, newArray, newInstance, newLabel, newLocal, not, pop, pop2, push, push, push, push, push, push, push, putField, putStatic, ret, returnValue, storeArg, storeLocal, storeLocal, swap, swap, tableSwitch, tableSwitch, throwException, throwException, unbox |
| Methods inherited from class org.objectweb.asm.commons.LocalVariablesSorter |
newLocal, visitIincInsn, visitLocalVariable, visitMaxs |
| Methods inherited from class org.objectweb.asm.MethodAdapter |
visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitEnd, visitLineNumber, visitParameterAnnotation, visitTryCatchBlock |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected int methodAccess
protected String methodDesc
| Constructor Detail |
public AdviceAdapter(MethodVisitor mv,
int access,
String name,
String desc)
AdviceAdapter.
mv - the method visitor to which this adapter delegates calls.access - the method's access flags (see Opcodes).name - the method's name.desc - the method's descriptor (see Type).| Method Detail |
public void visitLabel(Label label)
MethodVisitor
visitLabel in interface MethodVisitorvisitLabel in class MethodAdapterpublic void visitInsn(int opcode)
MethodVisitor
visitInsn in interface MethodVisitorvisitInsn in class MethodAdapter
public void visitVarInsn(int opcode,
int var)
MethodVisitor
visitVarInsn in interface MethodVisitorvisitVarInsn in class LocalVariablesSorter
public void visitFieldInsn(int opcode,
String owner,
String name,
String desc)
MethodVisitor
visitFieldInsn in interface MethodVisitorvisitFieldInsn in class MethodAdapter
public void visitIntInsn(int opcode,
int operand)
MethodVisitor
visitIntInsn in interface MethodVisitorvisitIntInsn in class MethodAdapterpublic void visitLdcInsn(Object cst)
MethodVisitor
visitLdcInsn in interface MethodVisitorvisitLdcInsn in class MethodAdapter
public void visitMultiANewArrayInsn(String desc,
int dims)
MethodVisitor
visitMultiANewArrayInsn in interface MethodVisitorvisitMultiANewArrayInsn in class MethodAdapter
public void visitTypeInsn(int opcode,
String name)
MethodVisitor
visitTypeInsn in interface MethodVisitorvisitTypeInsn in class MethodAdapter
public void visitMethodInsn(int opcode,
String owner,
String name,
String desc)
MethodVisitor
visitMethodInsn in interface MethodVisitorvisitMethodInsn in class MethodAdapter
public void visitJumpInsn(int opcode,
Label label)
MethodVisitor
visitJumpInsn in interface MethodVisitorvisitJumpInsn in class MethodAdapter
public void visitLookupSwitchInsn(Label dflt,
int[] keys,
Label[] labels)
MethodVisitor
visitLookupSwitchInsn in interface MethodVisitorvisitLookupSwitchInsn in class MethodAdapter
public void visitTableSwitchInsn(int min,
int max,
Label dflt,
Label[] labels)
MethodVisitor
visitTableSwitchInsn in interface MethodVisitorvisitTableSwitchInsn in class MethodAdapterprotected abstract void onMethodEnter()
protected abstract void onMethodExit(int opcode)
public void onMethodExit(int opcode) {
if(opcode==RETURN) {
visitInsn(ACONST_NULL);
} else if(opcode==ARETURN || opcode==ATHROW) {
dup();
} else {
if(opcode==LRETURN || opcode==DRETURN) {
dup2();
} else {
dup();
}
box(Type.getReturnType(this.methodDesc));
}
visitIntInsn(SIPUSH, opcode);
visitMethodInsn(INVOKESTATIC, owner, "onExit", "(Ljava/lang/Object;I)V");
}
// an actual call back method
public static void onExit(int opcode, Object param) {
...
opcode - one of the RETURN, IRETURN, FRETURN,
ARETURN, LRETURN, DRETURN or ATHROW
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||