001: /*
002: * Copyright 2003 The Apache Software Foundation
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package net.sf.cglib.transform;
017:
018: import org.objectweb.asm.*;
019:
020: public class MethodVisitorTee implements MethodVisitor {
021: private MethodVisitor mv1, mv2;
022:
023: public MethodVisitorTee(MethodVisitor mv1, MethodVisitor mv2) {
024: this .mv1 = mv1;
025: this .mv2 = mv2;
026: }
027:
028: public AnnotationVisitor visitAnnotationDefault() {
029: return AnnotationVisitorTee
030: .getInstance(mv1.visitAnnotationDefault(), mv2
031: .visitAnnotationDefault());
032: }
033:
034: public AnnotationVisitor visitAnnotation(String desc,
035: boolean visible) {
036: return AnnotationVisitorTee.getInstance(mv1.visitAnnotation(
037: desc, visible), mv2.visitAnnotation(desc, visible));
038: }
039:
040: public AnnotationVisitor visitParameterAnnotation(int parameter,
041: String desc, boolean visible) {
042: return AnnotationVisitorTee.getInstance(mv1
043: .visitParameterAnnotation(parameter, desc, visible),
044: mv2.visitParameterAnnotation(parameter, desc, visible));
045: }
046:
047: public void visitAttribute(Attribute attr) {
048: mv1.visitAttribute(attr);
049: mv2.visitAttribute(attr);
050: }
051:
052: public void visitCode() {
053: mv1.visitCode();
054: mv2.visitCode();
055: }
056:
057: public void visitInsn(int opcode) {
058: mv1.visitInsn(opcode);
059: mv2.visitInsn(opcode);
060: }
061:
062: public void visitIntInsn(int opcode, int operand) {
063: mv1.visitIntInsn(opcode, operand);
064: mv2.visitIntInsn(opcode, operand);
065: }
066:
067: public void visitVarInsn(int opcode, int var) {
068: mv1.visitVarInsn(opcode, var);
069: mv2.visitVarInsn(opcode, var);
070: }
071:
072: public void visitTypeInsn(int opcode, String desc) {
073: mv1.visitTypeInsn(opcode, desc);
074: mv2.visitTypeInsn(opcode, desc);
075: }
076:
077: public void visitFieldInsn(int opcode, String owner, String name,
078: String desc) {
079: mv1.visitFieldInsn(opcode, owner, name, desc);
080: mv2.visitFieldInsn(opcode, owner, name, desc);
081: }
082:
083: public void visitMethodInsn(int opcode, String owner, String name,
084: String desc) {
085: mv1.visitMethodInsn(opcode, owner, name, desc);
086: mv2.visitMethodInsn(opcode, owner, name, desc);
087: }
088:
089: public void visitJumpInsn(int opcode, Label label) {
090: mv1.visitJumpInsn(opcode, label);
091: mv2.visitJumpInsn(opcode, label);
092: }
093:
094: public void visitLabel(Label label) {
095: mv1.visitLabel(label);
096: mv2.visitLabel(label);
097: }
098:
099: public void visitLdcInsn(Object cst) {
100: mv1.visitLdcInsn(cst);
101: mv2.visitLdcInsn(cst);
102: }
103:
104: public void visitIincInsn(int var, int increment) {
105: mv1.visitIincInsn(var, increment);
106: mv2.visitIincInsn(var, increment);
107: }
108:
109: public void visitTableSwitchInsn(int min, int max, Label dflt,
110: Label labels[]) {
111: mv1.visitTableSwitchInsn(min, max, dflt, labels);
112: mv2.visitTableSwitchInsn(min, max, dflt, labels);
113: }
114:
115: public void visitLookupSwitchInsn(Label dflt, int keys[],
116: Label labels[]) {
117: mv1.visitLookupSwitchInsn(dflt, keys, labels);
118: mv2.visitLookupSwitchInsn(dflt, keys, labels);
119: }
120:
121: public void visitMultiANewArrayInsn(String desc, int dims) {
122: mv1.visitMultiANewArrayInsn(desc, dims);
123: mv2.visitMultiANewArrayInsn(desc, dims);
124: }
125:
126: public void visitTryCatchBlock(Label start, Label end,
127: Label handler, String type) {
128: mv1.visitTryCatchBlock(start, end, handler, type);
129: mv2.visitTryCatchBlock(start, end, handler, type);
130: }
131:
132: public void visitLocalVariable(String name, String desc,
133: String signature, Label start, Label end, int index) {
134: mv1
135: .visitLocalVariable(name, desc, signature, start, end,
136: index);
137: mv2
138: .visitLocalVariable(name, desc, signature, start, end,
139: index);
140: }
141:
142: public void visitLineNumber(int line, Label start) {
143: mv1.visitLineNumber(line, start);
144: mv2.visitLineNumber(line, start);
145: }
146:
147: public void visitMaxs(int maxStack, int maxLocals) {
148: mv1.visitMaxs(maxStack, maxLocals);
149: mv2.visitMaxs(maxStack, maxLocals);
150: }
151:
152: public void visitEnd() {
153: mv1.visitEnd();
154: mv2.visitEnd();
155: }
156: }
|