1 /*
   2  * Copyright 2004 Sun Microsystems, Inc.  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.  Sun designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any questions.
  24  */
  25 
  26 package com.sun.mirror.util;
  27 
  28 import com.sun.mirror.declaration.*;
  29 
  30 
  31 /**
  32  * A visitor for declarations, in the style of the standard visitor
  33  * design pattern.  Classes implementing this interface are used to
  34  * operate on a declaration when the kind of declaration is unknown at
  35  * compile time.  When a visitor is passed to a declaration's {@link
  36  * Declaration#accept accept} method, the most specific
  37  * <tt>visit<i>Xxx</i></tt> method applicable to that declaration is
  38  * invoked.
  39  *
  40  * @author Joseph D. Darcy
  41  * @author Scott Seligman
  42  * @since 1.5
  43  */
  44 
  45 public interface DeclarationVisitor {
  46 
  47     /**
  48      * Visits a declaration.
  49      * @param d the declaration to visit
  50      */
  51     public void visitDeclaration(Declaration d);
  52 
  53     /**
  54      * Visits a package declaration.
  55      * @param d the declaration to visit
  56      */
  57     public void visitPackageDeclaration(PackageDeclaration d);
  58 
  59     /**
  60      * Visits a member or constructor declaration.
  61      * @param d the declaration to visit
  62      */
  63     public void visitMemberDeclaration(MemberDeclaration d);
  64 
  65     /**
  66      * Visits a type declaration.
  67      * @param d the declaration to visit
  68      */
  69     public void visitTypeDeclaration(TypeDeclaration d);
  70 
  71     /**
  72      * Visits a class declaration.
  73      * @param d the declaration to visit
  74      */
  75     public void visitClassDeclaration(ClassDeclaration d);
  76 
  77     /**
  78      * Visits an enum declaration.
  79      * @param d the declaration to visit
  80      */
  81     public void visitEnumDeclaration(EnumDeclaration d);
  82 
  83     /**
  84      * Visits an interface declaration.
  85      * @param d the declaration to visit
  86      */
  87     public void visitInterfaceDeclaration(InterfaceDeclaration d);
  88 
  89     /**
  90      * Visits an annotation type declaration.
  91      * @param d the declaration to visit
  92      */
  93     public void visitAnnotationTypeDeclaration(AnnotationTypeDeclaration d);
  94 
  95     /**
  96      * Visits a field declaration.
  97      * @param d the declaration to visit
  98      */
  99     public void visitFieldDeclaration(FieldDeclaration d);
 100 
 101     /**
 102      * Visits an enum constant declaration.
 103      * @param d the declaration to visit
 104      */
 105     public void visitEnumConstantDeclaration(EnumConstantDeclaration d);
 106 
 107     /**
 108      * Visits a method or constructor declaration.
 109      * @param d the declaration to visit
 110      */
 111     public void visitExecutableDeclaration(ExecutableDeclaration d);
 112 
 113     /**
 114      * Visits a constructor declaration.
 115      * @param d the declaration to visit
 116      */
 117     public void visitConstructorDeclaration(ConstructorDeclaration d);
 118 
 119     /**
 120      * Visits a method declaration.
 121      * @param d the declaration to visit
 122      */
 123     public void visitMethodDeclaration(MethodDeclaration d);
 124 
 125     /**
 126      * Visits an annotation type element declaration.
 127      * @param d the declaration to visit
 128      */
 129     public void visitAnnotationTypeElementDeclaration(
 130                                      AnnotationTypeElementDeclaration d);
 131 
 132     /**
 133      * Visits a parameter declaration.
 134      * @param d the declaration to visit
 135      */
 136     public void visitParameterDeclaration(ParameterDeclaration d);
 137 
 138     /**
 139      * Visits a type parameter declaration.
 140      * @param d the declaration to visit
 141      */
 142     public void visitTypeParameterDeclaration(TypeParameterDeclaration d);
 143 }