KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > cglib > transform > CodeVisitorTee


1 /*
2  * Copyright 2003 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package net.sf.cglib.transform;
17
18 import org.objectweb.asm.Attribute;
19 import org.objectweb.asm.CodeVisitor;
20 import org.objectweb.asm.Label;
21
22 public class CodeVisitorTee implements CodeVisitor {
23     private CodeVisitor cv1, cv2;
24     
25     public CodeVisitorTee(CodeVisitor cv1, CodeVisitor cv2) {
26         this.cv1 = cv1;
27         this.cv2 = cv2;
28     }
29
30     public void visitFieldInsn(int opcode, String JavaDoc owner, String JavaDoc name, String JavaDoc desc) {
31         cv1.visitFieldInsn(opcode, owner, name, desc);
32         cv2.visitFieldInsn(opcode, owner, name, desc);
33     }
34         
35     public void visitIincInsn(int var, int increment) {
36         cv1.visitIincInsn(var, increment);
37         cv2.visitIincInsn(var, increment);
38     }
39         
40     public void visitInsn(int opcode) {
41         cv1.visitInsn(opcode);
42         cv2.visitInsn(opcode);
43     }
44         
45     public void visitIntInsn(int opcode, int operand) {
46         cv1.visitIntInsn(opcode, operand);
47         cv2.visitIntInsn(opcode, operand);
48     }
49         
50     public void visitJumpInsn(int opcode, Label label) {
51         cv1.visitJumpInsn(opcode, label);
52         cv2.visitJumpInsn(opcode, label);
53     }
54         
55     public void visitLabel(Label label) {
56         cv1.visitLabel(label);
57         cv2.visitLabel(label);
58     }
59         
60     public void visitLdcInsn(Object JavaDoc cst) {
61         cv1.visitLdcInsn(cst);
62         cv2.visitLdcInsn(cst);
63     }
64         
65     public void visitLineNumber(int line, Label start) {
66         cv1.visitLineNumber(line, start);
67         cv2.visitLineNumber(line, start);
68     }
69         
70     public void visitLocalVariable(String JavaDoc name, String JavaDoc desc, Label start, Label end, int index) {
71         cv1.visitLocalVariable(name, desc, start, end, index);
72         cv2.visitLocalVariable(name, desc, start, end, index);
73     }
74         
75     public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) {
76         cv1.visitLookupSwitchInsn(dflt, keys, labels);
77         cv2.visitLookupSwitchInsn(dflt, keys, labels);
78     }
79         
80     public void visitMaxs(int maxStack, int maxLocals) {
81         cv1.visitMaxs(maxStack, maxLocals);
82         cv2.visitMaxs(maxStack, maxLocals);
83     }
84         
85     public void visitMethodInsn(int opcode, String JavaDoc owner, String JavaDoc name, String JavaDoc desc) {
86         cv1.visitMethodInsn(opcode, owner, name, desc);
87         cv2.visitMethodInsn(opcode, owner, name, desc);
88     }
89         
90     public void visitMultiANewArrayInsn(String JavaDoc desc, int dims) {
91         cv1.visitMultiANewArrayInsn(desc, dims);
92         cv2.visitMultiANewArrayInsn(desc, dims);
93     }
94         
95     public void visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels) {
96         cv1.visitTableSwitchInsn(min, max, dflt, labels);
97         cv2.visitTableSwitchInsn(min, max, dflt, labels);
98     }
99         
100     public void visitTryCatchBlock(Label start, Label end, Label handler, String JavaDoc type) {
101         cv1.visitTryCatchBlock(start, end, handler, type);
102         cv2.visitTryCatchBlock(start, end, handler, type);
103     }
104         
105     public void visitTypeInsn(int opcode, String JavaDoc desc) {
106         cv1.visitTypeInsn(opcode, desc);
107         cv2.visitTypeInsn(opcode, desc);
108     }
109         
110     public void visitVarInsn(int opcode, int var) {
111         cv1.visitVarInsn(opcode, var);
112         cv2.visitVarInsn(opcode, var);
113     }
114
115     public void visitAttribute(Attribute attrs) {
116         cv1.visitAttribute(attrs);
117         cv2.visitAttribute(attrs);
118     }
119 }
120
121
Popular Tags