KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > libraries > asm > CodeAdapter


1 /***
2  * ASM: a very small and fast Java bytecode manipulation framework
3  * Copyright (c) 2000,2002,2003 INRIA, France Telecom
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * 3. Neither the name of the copyright holders nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28  * THE POSSIBILITY OF SUCH DAMAGE.
29  */

30
31 package oracle.toplink.libraries.asm;
32
33 /**
34  * An empty {@link CodeVisitor CodeVisitor} that delegates to another {@link
35  * CodeVisitor CodeVisitor}. This class can be used as a super class to quickly
36  * implement usefull code adapter classes, just by overriding the necessary
37  * methods.
38  *
39  * @author Eric Bruneton
40  */

41
42 public class CodeAdapter implements CodeVisitor {
43
44   /**
45    * The {@link CodeVisitor CodeVisitor} to which this adapter delegates calls.
46    */

47
48   protected CodeVisitor cv;
49
50   /**
51    * Constructs a new {@link CodeAdapter CodeAdapter} object.
52    *
53    * @param cv the code visitor to which this adapter must delegate calls.
54    */

55
56   public CodeAdapter (final CodeVisitor cv) {
57     this.cv = cv;
58   }
59
60   public void visitInsn (final int opcode) {
61     cv.visitInsn(opcode);
62   }
63
64   public void visitIntInsn (final int opcode, final int operand) {
65     cv.visitIntInsn(opcode, operand);
66   }
67
68   public void visitVarInsn (final int opcode, final int var) {
69     cv.visitVarInsn(opcode, var);
70   }
71
72   public void visitTypeInsn (final int opcode, final String JavaDoc desc) {
73     cv.visitTypeInsn(opcode, desc);
74   }
75
76   public void visitFieldInsn (
77     final int opcode,
78     final String JavaDoc owner,
79     final String JavaDoc name,
80     final String JavaDoc desc)
81   {
82     cv.visitFieldInsn(opcode, owner, name, desc);
83   }
84
85   public void visitMethodInsn (
86     final int opcode,
87     final String JavaDoc owner,
88     final String JavaDoc name,
89     final String JavaDoc desc)
90   {
91     cv.visitMethodInsn(opcode, owner, name, desc);
92   }
93
94   public void visitJumpInsn (final int opcode, final Label label) {
95     cv.visitJumpInsn(opcode, label);
96   }
97
98   public void visitLabel (final Label label) {
99     cv.visitLabel(label);
100   }
101
102   public void visitLdcInsn (final Object JavaDoc cst) {
103     cv.visitLdcInsn(cst);
104   }
105
106   public void visitIincInsn (final int var, final int increment) {
107     cv.visitIincInsn(var, increment);
108   }
109
110   public void visitTableSwitchInsn (
111     final int min,
112     final int max,
113     final Label dflt,
114     final Label labels[])
115   {
116     cv.visitTableSwitchInsn(min, max, dflt, labels);
117   }
118
119   public void visitLookupSwitchInsn (
120     final Label dflt,
121     final int keys[],
122     final Label labels[])
123   {
124     cv.visitLookupSwitchInsn(dflt, keys, labels);
125   }
126
127   public void visitMultiANewArrayInsn (final String JavaDoc desc, final int dims) {
128     cv.visitMultiANewArrayInsn(desc, dims);
129   }
130
131   public void visitTryCatchBlock (
132     final Label start,
133     final Label end,
134     final Label handler,
135     final String JavaDoc type)
136   {
137     cv.visitTryCatchBlock(start, end, handler, type);
138   }
139
140   public void visitMaxs (final int maxStack, final int maxLocals) {
141     cv.visitMaxs(maxStack, maxLocals);
142   }
143
144   public void visitLocalVariable (
145     final String JavaDoc name,
146     final String JavaDoc desc,
147     final Label start,
148     final Label end,
149     final int index)
150   {
151     cv.visitLocalVariable(name, desc, start, end, index);
152   }
153
154   public void visitLineNumber (final int line, final Label start) {
155     cv.visitLineNumber(line, start);
156   }
157
158   public void visitAttribute (final Attribute attr) {
159     cv.visitAttribute(attr);
160   }
161 }
162
Popular Tags