1 package net.sf.cglib.transform;
2
3 import org.objectweb.asm.Attribute;
4 import org.objectweb.asm.CodeVisitor;
5 import org.objectweb.asm.ClassVisitor;
6
7 public class ClassVisitorTee implements ClassVisitor {
8 private ClassVisitor cv1, cv2;
9
10 public ClassVisitorTee(ClassVisitor cv1, ClassVisitor cv2) {
11 this.cv1 = cv1;
12 this.cv2 = cv2;
13 }
14
15 public void visit(int access, String name, String superName, String[] interfaces, String sourceFile) {
16 cv1.visit(access, name, superName, interfaces, sourceFile);
17 cv2.visit(access, name, superName, interfaces, sourceFile);
18 }
19
20 public void visitEnd() {
21 cv1.visitEnd();
22 cv2.visitEnd();
23 cv1 = cv2 = null;
24 }
25
26 public void visitField(int access, String name, String desc, Object value, Attribute attrs) {
27 cv1.visitField(access, name, desc, value, attrs);
28 cv2.visitField(access, name, desc, value, attrs);
29 }
30
31 public void visitInnerClass(String name, String outerName, String innerName, int access) {
32 cv1.visitInnerClass(name, outerName, innerName, access);
33 cv2.visitInnerClass(name, outerName, innerName, access);
34 }
35
36 public CodeVisitor visitMethod(int access, String name, String desc, String[] exceptions, Attribute attrs) {
37 CodeVisitor code1 = cv1.visitMethod(access, name, desc, exceptions, attrs);
38 CodeVisitor code2 = cv2.visitMethod(access, name, desc, exceptions, attrs);
39 if (code1 == null) {
40 return code2;
41 } else if (code2 == null) {
42 return code1;
43 } else {
44 return new CodeVisitorTee(code1, code2);
45 }
46 }
47
48 public void visitAttribute(Attribute attrs) {
49 cv1.visitAttribute(attrs);
50 cv2.visitAttribute(attrs);
51 }
52 }
This page was automatically generated by Maven