KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > asm > MethodAdapter


1 /***
2  * ASM: a very small and fast Java bytecode manipulation framework
3  * Copyright (c) 2000-2005 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 package com.tc.asm;
31
32 /**
33  * An empty {@link MethodVisitor} that delegates to another
34  * {@link MethodVisitor}. This class can be used as a super class to quickly
35  * implement usefull method adapter classes, just by overriding the necessary
36  * methods.
37  *
38  * @author Eric Bruneton
39  */

40 public class MethodAdapter implements MethodVisitor {
41
42     /**
43      * The {@link MethodVisitor} to which this adapter delegates calls.
44      */

45     protected MethodVisitor mv;
46
47     /**
48      * Constructs a new {@link MethodAdapter} object.
49      *
50      * @param mv the code visitor to which this adapter must delegate calls.
51      */

52     public MethodAdapter(final MethodVisitor mv) {
53         this.mv = mv;
54     }
55
56     public AnnotationVisitor visitAnnotationDefault() {
57         return mv.visitAnnotationDefault();
58     }
59
60     public AnnotationVisitor visitAnnotation(
61         final String JavaDoc desc,
62         final boolean visible)
63     {
64         return mv.visitAnnotation(desc, visible);
65     }
66
67     public AnnotationVisitor visitParameterAnnotation(
68         final int parameter,
69         final String JavaDoc desc,
70         final boolean visible)
71     {
72         return mv.visitParameterAnnotation(parameter, desc, visible);
73     }
74
75     public void visitAttribute(final Attribute attr) {
76         mv.visitAttribute(attr);
77     }
78
79     public void visitCode() {
80         mv.visitCode();
81     }
82
83     public void visitInsn(final int opcode) {
84         mv.visitInsn(opcode);
85     }
86
87     public void visitIntInsn(final int opcode, final int operand) {
88         mv.visitIntInsn(opcode, operand);
89     }
90
91     public void visitVarInsn(final int opcode, final int var) {
92         mv.visitVarInsn(opcode, var);
93     }
94
95     public void visitTypeInsn(final int opcode, final String JavaDoc desc) {
96         mv.visitTypeInsn(opcode, desc);
97     }
98
99     public void visitFieldInsn(
100         final int opcode,
101         final String JavaDoc owner,
102         final String JavaDoc name,
103         final String JavaDoc desc)
104     {
105         mv.visitFieldInsn(opcode, owner, name, desc);
106     }
107
108     public void visitMethodInsn(
109         final int opcode,
110         final String JavaDoc owner,
111         final String JavaDoc name,
112         final String JavaDoc desc)
113     {
114         mv.visitMethodInsn(opcode, owner, name, desc);
115     }
116
117     public void visitJumpInsn(final int opcode, final Label label) {
118         mv.visitJumpInsn(opcode, label);
119     }
120
121     public void visitLabel(final Label label) {
122         mv.visitLabel(label);
123     }
124
125     public void visitLdcInsn(final Object JavaDoc cst) {
126         mv.visitLdcInsn(cst);
127     }
128
129     public void visitIincInsn(final int var, final int increment) {
130         mv.visitIincInsn(var, increment);
131     }
132
133     public void visitTableSwitchInsn(
134         final int min,
135         final int max,
136         final Label dflt,
137         final Label labels[])
138     {
139         mv.visitTableSwitchInsn(min, max, dflt, labels);
140     }
141
142     public void visitLookupSwitchInsn(
143         final Label dflt,
144         final int keys[],
145         final Label labels[])
146     {
147         mv.visitLookupSwitchInsn(dflt, keys, labels);
148     }
149
150     public void visitMultiANewArrayInsn(final String JavaDoc desc, final int dims) {
151         mv.visitMultiANewArrayInsn(desc, dims);
152     }
153
154     public void visitTryCatchBlock(
155         final Label start,
156         final Label end,
157         final Label handler,
158         final String JavaDoc type)
159     {
160         mv.visitTryCatchBlock(start, end, handler, type);
161     }
162
163     public void visitLocalVariable(
164         final String JavaDoc name,
165         final String JavaDoc desc,
166         final String JavaDoc signature,
167         final Label start,
168         final Label end,
169         final int index)
170     {
171         mv.visitLocalVariable(name, desc, signature, start, end, index);
172     }
173
174     public void visitLineNumber(final int line, final Label start) {
175         mv.visitLineNumber(line, start);
176     }
177
178     public void visitMaxs(final int maxStack, final int maxLocals) {
179         mv.visitMaxs(maxStack, maxLocals);
180     }
181
182     public void visitEnd() {
183         mv.visitEnd();
184     }
185 }
186
Popular Tags