1 /*
   2  * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.mirror.util;
  27 
  28 
  29 import com.sun.mirror.declaration.*;
  30 
  31 
  32 /**
  33  * A simple visitor for declarations.
  34  *
  35  * <p> The implementations of the methods of this class do nothing but
  36  * delegate up the declaration hierarchy.  A subclass should override the
  37  * methods that correspond to the kinds of declarations on which it
  38  * will operate.
  39  *
  40  * @deprecated All components of this API have been superseded by the
  41  * standardized annotation processing API.  The replacement for the
  42  * functionality of this class is {@link
  43  * javax.lang.model.util.SimpleElementVisitor6}.
  44  *
  45  * @author Joseph D. Darcy
  46  * @author Scott Seligman
  47  * @since 1.5
  48  */
  49 @Deprecated
  50 @SuppressWarnings("deprecation")
  51 public class SimpleDeclarationVisitor implements DeclarationVisitor {
  52 
  53     /**
  54      * Creates a new <tt>SimpleDeclarationVisitor</tt>.
  55      */
  56     public SimpleDeclarationVisitor(){}
  57 
  58     /**
  59      * Visits a declaration.
  60      * The implementation does nothing.
  61      * @param d the declaration to visit
  62      */
  63     public void visitDeclaration(Declaration d) {
  64     }
  65 
  66     /**
  67      * Visits a package declaration.
  68      * The implementation simply invokes
  69      * {@link #visitDeclaration visitDeclaration}.
  70      * @param d the declaration to visit
  71      */
  72     public void visitPackageDeclaration(PackageDeclaration d) {
  73         visitDeclaration(d);
  74     }
  75 
  76     /**
  77      * Visits a member or constructor declaration.
  78      * The implementation simply invokes
  79      * {@link #visitDeclaration visitDeclaration}.
  80      * @param d the declaration to visit
  81      */
  82     public void visitMemberDeclaration(MemberDeclaration d) {
  83         visitDeclaration(d);
  84     }
  85 
  86     /**
  87      * Visits a type declaration.
  88      * The implementation simply invokes
  89      * {@link #visitMemberDeclaration visitMemberDeclaration}.
  90      * @param d the declaration to visit
  91      */
  92     public void visitTypeDeclaration(TypeDeclaration d) {
  93         visitMemberDeclaration(d);
  94     }
  95 
  96     /**
  97      * Visits a class declaration.
  98      * The implementation simply invokes
  99      * {@link #visitTypeDeclaration visitTypeDeclaration}.
 100      * @param d the declaration to visit
 101      */
 102     public void visitClassDeclaration(ClassDeclaration d) {
 103         visitTypeDeclaration(d);
 104     }
 105 
 106     /**
 107      * Visits an enum declaration.
 108      * The implementation simply invokes
 109      * {@link #visitClassDeclaration visitClassDeclaration}.
 110      * @param d the declaration to visit
 111      */
 112     public void visitEnumDeclaration(EnumDeclaration d) {
 113         visitClassDeclaration(d);
 114     }
 115 
 116     /**
 117      * Visits an interface declaration.
 118      * The implementation simply invokes
 119      * {@link #visitTypeDeclaration visitTypeDeclaration}.
 120      * @param d the declaration to visit
 121      */
 122     public void visitInterfaceDeclaration(InterfaceDeclaration d) {
 123         visitTypeDeclaration(d);
 124     }
 125 
 126     /**
 127      * Visits an annotation type declaration.
 128      * The implementation simply invokes
 129      * {@link #visitInterfaceDeclaration visitInterfaceDeclaration}.
 130      * @param d the declaration to visit
 131      */
 132     public void visitAnnotationTypeDeclaration(AnnotationTypeDeclaration d) {
 133         visitInterfaceDeclaration(d);
 134     }
 135 
 136     /**
 137      * Visits a field declaration.
 138      * The implementation simply invokes
 139      * {@link #visitMemberDeclaration visitMemberDeclaration}.
 140      * @param d the declaration to visit
 141      */
 142     public void visitFieldDeclaration(FieldDeclaration d) {
 143         visitMemberDeclaration(d);
 144     }
 145 
 146     /**
 147      * Visits an enum constant declaration.
 148      * The implementation simply invokes
 149      * {@link #visitFieldDeclaration visitFieldDeclaration}.
 150      * @param d the declaration to visit
 151      */
 152     public void visitEnumConstantDeclaration(EnumConstantDeclaration d) {
 153         visitFieldDeclaration(d);
 154     }
 155 
 156     /**
 157      * Visits a method or constructor declaration.
 158      * The implementation simply invokes
 159      * {@link #visitMemberDeclaration visitMemberDeclaration}.
 160      * @param d the declaration to visit
 161      */
 162     public void visitExecutableDeclaration(ExecutableDeclaration d) {
 163         visitMemberDeclaration(d);
 164     }
 165 
 166     /**
 167      * Visits a constructor declaration.
 168      * The implementation simply invokes
 169      * {@link #visitExecutableDeclaration visitExecutableDeclaration}.
 170      * @param d the declaration to visit
 171      */
 172     public void visitConstructorDeclaration(ConstructorDeclaration d) {
 173         visitExecutableDeclaration(d);
 174     }
 175 
 176     /**
 177      * Visits a method declaration.
 178      * The implementation simply invokes
 179      * {@link #visitExecutableDeclaration visitExecutableDeclaration}.
 180      * @param d the declaration to visit
 181      */
 182     public void visitMethodDeclaration(MethodDeclaration d) {
 183         visitExecutableDeclaration(d);
 184     }
 185 
 186     /**
 187      * Visits an annotation type element declaration.
 188      * The implementation simply invokes
 189      * {@link #visitMethodDeclaration visitMethodDeclaration}.
 190      * @param d the declaration to visit
 191      */
 192     public void visitAnnotationTypeElementDeclaration(
 193             AnnotationTypeElementDeclaration d) {
 194         visitMethodDeclaration(d);
 195     }
 196 
 197     /**
 198      * Visits a parameter declaration.
 199      * The implementation simply invokes
 200      * {@link #visitDeclaration visitDeclaration}.
 201      * @param d the declaration to visit
 202      */
 203     public void visitParameterDeclaration(ParameterDeclaration d) {
 204         visitDeclaration(d);
 205     }
 206 
 207     /**
 208      * Visits a type parameter declaration.
 209      * The implementation simply invokes
 210      * {@link #visitDeclaration visitDeclaration}.
 211      * @param d the declaration to visit
 212      */
 213     public void visitTypeParameterDeclaration(TypeParameterDeclaration d) {
 214         visitDeclaration(d);
 215     }
 216 }