001    /*
002     * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
003     * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004     *
005     * This code is free software; you can redistribute it and/or modify it
006     * under the terms of the GNU General Public License version 2 only, as
007     * published by the Free Software Foundation.  Sun designates this
008     * particular file as subject to the "Classpath" exception as provided
009     * by Sun in the LICENSE file that accompanied this code.
010     *
011     * This code is distributed in the hope that it will be useful, but WITHOUT
012     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013     * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014     * version 2 for more details (a copy is included in the LICENSE file that
015     * accompanied this code).
016     *
017     * You should have received a copy of the GNU General Public License version
018     * 2 along with this work; if not, write to the Free Software Foundation,
019     * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020     *
021     * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022     * CA 95054 USA or visit www.sun.com if you need additional information or
023     * have any questions.
024     */
025    
026    package com.sun.mirror.util;
027    
028    import com.sun.mirror.declaration.*;
029    
030    
031    /**
032     * A visitor for declarations, in the style of the standard visitor
033     * design pattern.  Classes implementing this interface are used to
034     * operate on a declaration when the kind of declaration is unknown at
035     * compile time.  When a visitor is passed to a declaration's {@link
036     * Declaration#accept accept} method, the most specific
037     * <tt>visit<i>Xxx</i></tt> method applicable to that declaration is
038     * invoked.
039     *
040     * @author Joseph D. Darcy
041     * @author Scott Seligman
042     * @since 1.5
043     */
044    
045    public interface DeclarationVisitor {
046    
047        /**
048         * Visits a declaration.
049         * @param d the declaration to visit
050         */
051        public void visitDeclaration(Declaration d);
052    
053        /**
054         * Visits a package declaration.
055         * @param d the declaration to visit
056         */
057        public void visitPackageDeclaration(PackageDeclaration d);
058    
059        /**
060         * Visits a member or constructor declaration.
061         * @param d the declaration to visit
062         */
063        public void visitMemberDeclaration(MemberDeclaration d);
064    
065        /**
066         * Visits a type declaration.
067         * @param d the declaration to visit
068         */
069        public void visitTypeDeclaration(TypeDeclaration d);
070    
071        /**
072         * Visits a class declaration.
073         * @param d the declaration to visit
074         */
075        public void visitClassDeclaration(ClassDeclaration d);
076    
077        /**
078         * Visits an enum declaration.
079         * @param d the declaration to visit
080         */
081        public void visitEnumDeclaration(EnumDeclaration d);
082    
083        /**
084         * Visits an interface declaration.
085         * @param d the declaration to visit
086         */
087        public void visitInterfaceDeclaration(InterfaceDeclaration d);
088    
089        /**
090         * Visits an annotation type declaration.
091         * @param d the declaration to visit
092         */
093        public void visitAnnotationTypeDeclaration(AnnotationTypeDeclaration d);
094    
095        /**
096         * Visits a field declaration.
097         * @param d the declaration to visit
098         */
099        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    }