| org.ejb3unit.asm.commons.LocalVariablesSorter org.ejb3unit.asm.commons.GeneratorAdapter org.ejb3unit.asm.commons.AdviceAdapter
AdviceAdapter | abstract public class AdviceAdapter extends GeneratorAdapter implements Opcodes(Code) | | A
org.ejb3unit.asm.MethodAdapter to insert before, after and around
advices in methods and constructors. The behavior for constructors is
like this:
- as long as the INVOKESPECIAL for the object initialization has not been
reached, every bytecode instruction is dispatched in the ctor code visitor
- when this one is reached, it is only added in the ctor code visitor and
a JP invoke is added
- after that, only the other code visitor receives the instructions
author: Eugene Kuleshov author: Eric Bruneton |
Method Summary | |
abstract protected void | onMethodEnter() Called at the beginning of the method or after super class class call in
the constructor. | abstract protected void | onMethodExit(int opcode) Called before explicit exit from the method using either return or throw. | public void | visitCode() | public void | visitFieldInsn(int opcode, String owner, String name, String desc) | public void | visitInsn(int opcode) | public void | visitIntInsn(int opcode, int operand) | public void | visitJumpInsn(int opcode, Label label) | public void | visitLabel(Label label) | public void | visitLdcInsn(Object cst) | public void | visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) | public void | visitMethodInsn(int opcode, String owner, String name, String desc) | public void | visitMultiANewArrayInsn(String desc, int dims) | public void | visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels) | public void | visitTypeInsn(int opcode, String name) | public void | visitVarInsn(int opcode, int var) |
methodAccess | protected int methodAccess(Code) | | |
AdviceAdapter | public AdviceAdapter(MethodVisitor mv, int access, String name, String desc)(Code) | | Creates a new
AdviceAdapter .
Parameters: mv - the method visitor to which this adapter delegates calls. Parameters: access - the method's access flags (see Opcodes). Parameters: name - the method's name. Parameters: desc - the method's descriptor (see Type Type). |
onMethodEnter | abstract protected void onMethodEnter()(Code) | | Called at the beginning of the method or after super class class call in
the constructor.
Custom code can use or change all the local variables, but should not
change state of the stack.
|
onMethodExit | abstract protected void onMethodExit(int opcode)(Code) | | Called before explicit exit from the method using either return or throw.
Top element on the stack contains the return value or exception instance.
For example:
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) {
...
Custom code can use or change all the local variables, but should not
change state of the stack.
Parameters: opcode - one of the RETURN, IRETURN, FRETURN, ARETURN, LRETURN,DRETURN or ATHROW |
visitCode | public void visitCode()(Code) | | |
visitInsn | public void visitInsn(int opcode)(Code) | | |
visitIntInsn | public void visitIntInsn(int opcode, int operand)(Code) | | |
visitJumpInsn | public void visitJumpInsn(int opcode, Label label)(Code) | | |
visitLookupSwitchInsn | public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels)(Code) | | |
visitMultiANewArrayInsn | public void visitMultiANewArrayInsn(String desc, int dims)(Code) | | |
visitTableSwitchInsn | public void visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels)(Code) | | |
visitTypeInsn | public void visitTypeInsn(int opcode, String name)(Code) | | |
visitVarInsn | public void visitVarInsn(int opcode, int var)(Code) | | |
Methods inherited from org.ejb3unit.asm.commons.GeneratorAdapter | public void arrayLength()(Code)(Java Doc) public void arrayLoad(Type type)(Code)(Java Doc) public void arrayStore(Type type)(Code)(Java Doc) public void box(Type type)(Code)(Java Doc) public void cast(Type from, Type to)(Code)(Java Doc) public void catchException(Label start, Label end, Type exception)(Code)(Java Doc) public void checkCast(Type type)(Code)(Java Doc) public void dup()(Code)(Java Doc) public void dup2()(Code)(Java Doc) public void dup2X1()(Code)(Java Doc) public void dup2X2()(Code)(Java Doc) public void dupX1()(Code)(Java Doc) public void dupX2()(Code)(Java Doc) public void endMethod()(Code)(Java Doc) public void getField(Type owner, String name, Type type)(Code)(Java Doc) public Type getLocalType(int local)(Code)(Java Doc) public void getStatic(Type owner, String name, Type type)(Code)(Java Doc) public void goTo(Label label)(Code)(Java Doc) public void ifCmp(Type type, int mode, Label label)(Code)(Java Doc) public void ifICmp(int mode, Label label)(Code)(Java Doc) public void ifNonNull(Label label)(Code)(Java Doc) public void ifNull(Label label)(Code)(Java Doc) public void ifZCmp(int mode, Label label)(Code)(Java Doc) public void iinc(int local, int amount)(Code)(Java Doc) public void instanceOf(Type type)(Code)(Java Doc) public void invokeConstructor(Type type, Method method)(Code)(Java Doc) public void invokeInterface(Type owner, Method method)(Code)(Java Doc) public void invokeStatic(Type owner, Method method)(Code)(Java Doc) public void invokeVirtual(Type owner, Method method)(Code)(Java Doc) public void loadArg(int arg)(Code)(Java Doc) public void loadArgArray()(Code)(Java Doc) public void loadArgs(int arg, int count)(Code)(Java Doc) public void loadArgs()(Code)(Java Doc) public void loadLocal(int local)(Code)(Java Doc) public void loadLocal(int local, Type type)(Code)(Java Doc) public void loadThis()(Code)(Java Doc) public void mark(Label label)(Code)(Java Doc) public Label mark()(Code)(Java Doc) public void math(int op, Type type)(Code)(Java Doc) public void monitorEnter()(Code)(Java Doc) public void monitorExit()(Code)(Java Doc) public void newArray(Type type)(Code)(Java Doc) public void newInstance(Type type)(Code)(Java Doc) public Label newLabel()(Code)(Java Doc) public void not()(Code)(Java Doc) public void pop()(Code)(Java Doc) public void pop2()(Code)(Java Doc) public void push(boolean value)(Code)(Java Doc) public void push(int value)(Code)(Java Doc) public void push(long value)(Code)(Java Doc) public void push(float value)(Code)(Java Doc) public void push(double value)(Code)(Java Doc) public void push(String value)(Code)(Java Doc) public void push(Type value)(Code)(Java Doc) public void putField(Type owner, String name, Type type)(Code)(Java Doc) public void putStatic(Type owner, String name, Type type)(Code)(Java Doc) public void ret(int local)(Code)(Java Doc) public void returnValue()(Code)(Java Doc) protected void setLocalType(int local, Type type)(Code)(Java Doc) public void storeArg(int arg)(Code)(Java Doc) public void storeLocal(int local)(Code)(Java Doc) public void storeLocal(int local, Type type)(Code)(Java Doc) public void swap()(Code)(Java Doc) public void swap(Type prev, Type type)(Code)(Java Doc) public void tableSwitch(int[] keys, TableSwitchGenerator generator)(Code)(Java Doc) public void tableSwitch(int[] keys, TableSwitchGenerator generator, boolean useTable)(Code)(Java Doc) public void throwException()(Code)(Java Doc) public void throwException(Type type, String msg)(Code)(Java Doc) public void unbox(Type type)(Code)(Java Doc)
|
Methods inherited from org.ejb3unit.asm.commons.LocalVariablesSorter | public int newLocal(Type type)(Code)(Java Doc) protected void setLocalType(int local, Type type)(Code)(Java Doc) public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack)(Code)(Java Doc) public void visitIincInsn(int var, int increment)(Code)(Java Doc) public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index)(Code)(Java Doc) public void visitMaxs(int maxStack, int maxLocals)(Code)(Java Doc) public void visitVarInsn(int opcode, int var)(Code)(Java Doc)
|
|
|