annotate src/clojure/asm/ClassAdapter.java @ 10:ef7dbbd6452c

added clojure source goodness
author Robert McIntyre <rlm@mit.edu>
date Sat, 21 Aug 2010 06:25:44 -0400
parents
children
rev   line source
rlm@10 1 /***
rlm@10 2 * ASM: a very small and fast Java bytecode manipulation framework
rlm@10 3 * Copyright (c) 2000-2005 INRIA, France Telecom
rlm@10 4 * All rights reserved.
rlm@10 5 *
rlm@10 6 * Redistribution and use in source and binary forms, with or without
rlm@10 7 * modification, are permitted provided that the following conditions
rlm@10 8 * are met:
rlm@10 9 * 1. Redistributions of source code must retain the above copyright
rlm@10 10 * notice, this list of conditions and the following disclaimer.
rlm@10 11 * 2. Redistributions in binary form must reproduce the above copyright
rlm@10 12 * notice, this list of conditions and the following disclaimer in the
rlm@10 13 * documentation and/or other materials provided with the distribution.
rlm@10 14 * 3. Neither the name of the copyright holders nor the names of its
rlm@10 15 * contributors may be used to endorse or promote products derived from
rlm@10 16 * this software without specific prior written permission.
rlm@10 17 *
rlm@10 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
rlm@10 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
rlm@10 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
rlm@10 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
rlm@10 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
rlm@10 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
rlm@10 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
rlm@10 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
rlm@10 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
rlm@10 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
rlm@10 28 * THE POSSIBILITY OF SUCH DAMAGE.
rlm@10 29 */
rlm@10 30 package clojure.asm;
rlm@10 31
rlm@10 32 /**
rlm@10 33 * An empty {@link ClassVisitor} that delegates to another {@link ClassVisitor}.
rlm@10 34 * This class can be used as a super class to quickly implement usefull class
rlm@10 35 * adapter classes, just by overriding the necessary methods.
rlm@10 36 *
rlm@10 37 * @author Eric Bruneton
rlm@10 38 */
rlm@10 39 public class ClassAdapter implements ClassVisitor{
rlm@10 40
rlm@10 41 /**
rlm@10 42 * The {@link ClassVisitor} to which this adapter delegates calls.
rlm@10 43 */
rlm@10 44 protected ClassVisitor cv;
rlm@10 45
rlm@10 46 /**
rlm@10 47 * Constructs a new {@link ClassAdapter} object.
rlm@10 48 *
rlm@10 49 * @param cv the class visitor to which this adapter must delegate calls.
rlm@10 50 */
rlm@10 51 public ClassAdapter(final ClassVisitor cv){
rlm@10 52 this.cv = cv;
rlm@10 53 }
rlm@10 54
rlm@10 55 public void visit(
rlm@10 56 final int version,
rlm@10 57 final int access,
rlm@10 58 final String name,
rlm@10 59 final String signature,
rlm@10 60 final String superName,
rlm@10 61 final String[] interfaces){
rlm@10 62 cv.visit(version, access, name, signature, superName, interfaces);
rlm@10 63 }
rlm@10 64
rlm@10 65 public void visitSource(final String source, final String debug){
rlm@10 66 cv.visitSource(source, debug);
rlm@10 67 }
rlm@10 68
rlm@10 69 public void visitOuterClass(
rlm@10 70 final String owner,
rlm@10 71 final String name,
rlm@10 72 final String desc){
rlm@10 73 cv.visitOuterClass(owner, name, desc);
rlm@10 74 }
rlm@10 75
rlm@10 76 public AnnotationVisitor visitAnnotation(
rlm@10 77 final String desc,
rlm@10 78 final boolean visible){
rlm@10 79 return cv.visitAnnotation(desc, visible);
rlm@10 80 }
rlm@10 81
rlm@10 82 public void visitAttribute(final Attribute attr){
rlm@10 83 cv.visitAttribute(attr);
rlm@10 84 }
rlm@10 85
rlm@10 86 public void visitInnerClass(
rlm@10 87 final String name,
rlm@10 88 final String outerName,
rlm@10 89 final String innerName,
rlm@10 90 final int access){
rlm@10 91 cv.visitInnerClass(name, outerName, innerName, access);
rlm@10 92 }
rlm@10 93
rlm@10 94 public FieldVisitor visitField(
rlm@10 95 final int access,
rlm@10 96 final String name,
rlm@10 97 final String desc,
rlm@10 98 final String signature,
rlm@10 99 final Object value){
rlm@10 100 return cv.visitField(access, name, desc, signature, value);
rlm@10 101 }
rlm@10 102
rlm@10 103 public MethodVisitor visitMethod(
rlm@10 104 final int access,
rlm@10 105 final String name,
rlm@10 106 final String desc,
rlm@10 107 final String signature,
rlm@10 108 final String[] exceptions){
rlm@10 109 return cv.visitMethod(access, name, desc, signature, exceptions);
rlm@10 110 }
rlm@10 111
rlm@10 112 public void visitEnd(){
rlm@10 113 cv.visitEnd();
rlm@10 114 }
rlm@10 115 }