KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > 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  * Contact: Eric.Bruneton@rd.francetelecom.com
31  *
32  * Author: Eric Bruneton
33  */

34
35 package org.logicalcobwebs.asm;
36
37 /**
38  * An empty {@link CodeVisitor CodeVisitor} that delegates to another {@link
39  * CodeVisitor CodeVisitor}. This class can be used as a super class to quickly
40  * implement usefull code adapter classes, just by overriding the necessary
41  * methods.
42  */

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

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

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