001: /***
002: * ASM: a very small and fast Java bytecode manipulation framework
003: * Copyright (c) 2000-2005 INRIA, France Telecom
004: * All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions
008: * are met:
009: * 1. Redistributions of source code must retain the above copyright
010: * notice, this list of conditions and the following disclaimer.
011: * 2. Redistributions in binary form must reproduce the above copyright
012: * notice, this list of conditions and the following disclaimer in the
013: * documentation and/or other materials provided with the distribution.
014: * 3. Neither the name of the copyright holders nor the names of its
015: * contributors may be used to endorse or promote products derived from
016: * this software without specific prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
020: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
021: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
022: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
023: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
024: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
025: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
026: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
027: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
028: * THE POSSIBILITY OF SUCH DAMAGE.
029: */package org.drools.asm;
030:
031: /**
032: * An empty {@link MethodVisitor} that delegates to another
033: * {@link MethodVisitor}. This class can be used as a super class to quickly
034: * implement usefull method adapter classes, just by overriding the necessary
035: * methods.
036: *
037: * @author Eric Bruneton
038: */
039: public class MethodAdapter implements MethodVisitor {
040:
041: /**
042: * The {@link MethodVisitor} to which this adapter delegates calls.
043: */
044: protected MethodVisitor mv;
045:
046: /**
047: * Constructs a new {@link MethodAdapter} object.
048: *
049: * @param mv the code visitor to which this adapter must delegate calls.
050: */
051: public MethodAdapter(final MethodVisitor mv) {
052: this .mv = mv;
053: }
054:
055: public AnnotationVisitor visitAnnotationDefault() {
056: return this .mv.visitAnnotationDefault();
057: }
058:
059: public AnnotationVisitor visitAnnotation(final String desc,
060: final boolean visible) {
061: return this .mv.visitAnnotation(desc, visible);
062: }
063:
064: public AnnotationVisitor visitParameterAnnotation(
065: final int parameter, final String desc,
066: final boolean visible) {
067: return this .mv.visitParameterAnnotation(parameter, desc,
068: visible);
069: }
070:
071: public void visitAttribute(final Attribute attr) {
072: this .mv.visitAttribute(attr);
073: }
074:
075: public void visitCode() {
076: this .mv.visitCode();
077: }
078:
079: public void visitInsn(final int opcode) {
080: this .mv.visitInsn(opcode);
081: }
082:
083: public void visitIntInsn(final int opcode, final int operand) {
084: this .mv.visitIntInsn(opcode, operand);
085: }
086:
087: public void visitVarInsn(final int opcode, final int var) {
088: this .mv.visitVarInsn(opcode, var);
089: }
090:
091: public void visitTypeInsn(final int opcode, final String desc) {
092: this .mv.visitTypeInsn(opcode, desc);
093: }
094:
095: public void visitFieldInsn(final int opcode, final String owner,
096: final String name, final String desc) {
097: this .mv.visitFieldInsn(opcode, owner, name, desc);
098: }
099:
100: public void visitMethodInsn(final int opcode, final String owner,
101: final String name, final String desc) {
102: this .mv.visitMethodInsn(opcode, owner, name, desc);
103: }
104:
105: public void visitJumpInsn(final int opcode, final Label label) {
106: this .mv.visitJumpInsn(opcode, label);
107: }
108:
109: public void visitLabel(final Label label) {
110: this .mv.visitLabel(label);
111: }
112:
113: public void visitLdcInsn(final Object cst) {
114: this .mv.visitLdcInsn(cst);
115: }
116:
117: public void visitIincInsn(final int var, final int increment) {
118: this .mv.visitIincInsn(var, increment);
119: }
120:
121: public void visitTableSwitchInsn(final int min, final int max,
122: final Label dflt, final Label labels[]) {
123: this .mv.visitTableSwitchInsn(min, max, dflt, labels);
124: }
125:
126: public void visitLookupSwitchInsn(final Label dflt,
127: final int keys[], final Label labels[]) {
128: this .mv.visitLookupSwitchInsn(dflt, keys, labels);
129: }
130:
131: public void visitMultiANewArrayInsn(final String desc,
132: final int dims) {
133: this .mv.visitMultiANewArrayInsn(desc, dims);
134: }
135:
136: public void visitTryCatchBlock(final Label start, final Label end,
137: final Label handler, final String type) {
138: this .mv.visitTryCatchBlock(start, end, handler, type);
139: }
140:
141: public void visitLocalVariable(final String name,
142: final String desc, final String signature,
143: final Label start, final Label end, final int index) {
144: this .mv.visitLocalVariable(name, desc, signature, start, end,
145: index);
146: }
147:
148: public void visitLineNumber(final int line, final Label start) {
149: this .mv.visitLineNumber(line, start);
150: }
151:
152: public void visitMaxs(final int maxStack, final int maxLocals) {
153: this .mv.visitMaxs(maxStack, maxLocals);
154: }
155:
156: public void visitEnd() {
157: this.mv.visitEnd();
158: }
159: }
|