1 16 package net.sf.cglib.transform; 17 18 import org.objectweb.asm.*; 19 20 public class MethodVisitorTee implements MethodVisitor { 21 private MethodVisitor mv1, mv2; 22 23 public MethodVisitorTee(MethodVisitor mv1, MethodVisitor mv2) { 24 this.mv1 = mv1; 25 this.mv2 = mv2; 26 } 27 28 public AnnotationVisitor visitAnnotationDefault() { 29 return AnnotationVisitorTee.getInstance(mv1.visitAnnotationDefault(), 30 mv2.visitAnnotationDefault()); 31 } 32 33 public AnnotationVisitor visitAnnotation(String desc, boolean visible) { 34 return AnnotationVisitorTee.getInstance(mv1.visitAnnotation(desc, visible), 35 mv2.visitAnnotation(desc, visible)); 36 } 37 38 public AnnotationVisitor visitParameterAnnotation(int parameter, 39 String desc, 40 boolean visible) { 41 return AnnotationVisitorTee.getInstance(mv1.visitParameterAnnotation(parameter, desc, visible), 42 mv2.visitParameterAnnotation(parameter, desc, visible)); 43 } 44 45 public void visitAttribute(Attribute attr) { 46 mv1.visitAttribute(attr); 47 mv2.visitAttribute(attr); 48 } 49 50 public void visitCode() { 51 mv1.visitCode(); 52 mv2.visitCode(); 53 } 54 55 public void visitInsn(int opcode) { 56 mv1.visitInsn(opcode); 57 mv2.visitInsn(opcode); 58 } 59 60 public void visitIntInsn(int opcode, int operand) { 61 mv1.visitIntInsn(opcode, operand); 62 mv2.visitIntInsn(opcode, operand); 63 } 64 65 public void visitVarInsn(int opcode, int var) { 66 mv1.visitVarInsn(opcode, var); 67 mv2.visitVarInsn(opcode, var); 68 } 69 70 public void visitTypeInsn(int opcode, String desc) { 71 mv1.visitTypeInsn(opcode, desc); 72 mv2.visitTypeInsn(opcode, desc); 73 } 74 75 public void visitFieldInsn(int opcode, String owner, String name, String desc) { 76 mv1.visitFieldInsn(opcode, owner, name, desc); 77 mv2.visitFieldInsn(opcode, owner, name, desc); 78 } 79 80 public void visitMethodInsn(int opcode, String owner, String name, String desc) { 81 mv1.visitMethodInsn(opcode, owner, name, desc); 82 mv2.visitMethodInsn(opcode, owner, name, desc); 83 } 84 85 public void visitJumpInsn(int opcode, Label label) { 86 mv1.visitJumpInsn(opcode, label); 87 mv2.visitJumpInsn(opcode, label); 88 } 89 90 public void visitLabel(Label label) { 91 mv1.visitLabel(label); 92 mv2.visitLabel(label); 93 } 94 95 public void visitLdcInsn(Object cst) { 96 mv1.visitLdcInsn(cst); 97 mv2.visitLdcInsn(cst); 98 } 99 100 public void visitIincInsn(int var, int increment) { 101 mv1.visitIincInsn(var, increment); 102 mv2.visitIincInsn(var, increment); 103 } 104 105 public void visitTableSwitchInsn(int min, int max, Label dflt, Label labels[]) { 106 mv1.visitTableSwitchInsn(min, max, dflt, labels); 107 mv2.visitTableSwitchInsn(min, max, dflt, labels); 108 } 109 110 public void visitLookupSwitchInsn(Label dflt, int keys[], Label labels[]) { 111 mv1.visitLookupSwitchInsn(dflt, keys, labels); 112 mv2.visitLookupSwitchInsn(dflt, keys, labels); 113 } 114 115 public void visitMultiANewArrayInsn(String desc, int dims) { 116 mv1.visitMultiANewArrayInsn(desc, dims); 117 mv2.visitMultiANewArrayInsn(desc, dims); 118 } 119 120 public void visitTryCatchBlock(Label start, Label end, Label handler, String type) { 121 mv1.visitTryCatchBlock(start, end, handler, type); 122 mv2.visitTryCatchBlock(start, end, handler, type); 123 } 124 125 public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) { 126 mv1.visitLocalVariable(name, desc, signature, start, end, index); 127 mv2.visitLocalVariable(name, desc, signature, start, end, index); 128 } 129 130 public void visitLineNumber(int line, Label start) { 131 mv1.visitLineNumber(line, start); 132 mv2.visitLineNumber(line, start); 133 } 134 135 public void visitMaxs(int maxStack, int maxLocals) { 136 mv1.visitMaxs(maxStack, maxLocals); 137 mv2.visitMaxs(maxStack, maxLocals); 138 } 139 140 public void visitEnd() { 141 mv1.visitEnd(); 142 mv2.visitEnd(); 143 } 144 } 145 146 | Popular Tags |