ElementKindVisitor9.java revision 2571:10fc81ac75b4
1218885Sdim/*
2218885Sdim * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3218885Sdim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4218885Sdim *
5218885Sdim * This code is free software; you can redistribute it and/or modify it
6218885Sdim * under the terms of the GNU General Public License version 2 only, as
7218885Sdim * published by the Free Software Foundation.  Oracle designates this
8218885Sdim * particular file as subject to the "Classpath" exception as provided
9218885Sdim * by Oracle in the LICENSE file that accompanied this code.
10218885Sdim *
11218885Sdim * This code is distributed in the hope that it will be useful, but WITHOUT
12218885Sdim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13218885Sdim * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14218885Sdim * version 2 for more details (a copy is included in the LICENSE file that
15218885Sdim * accompanied this code).
16218885Sdim *
17249423Sdim * You should have received a copy of the GNU General Public License version
18218885Sdim * 2 along with this work; if not, write to the Free Software Foundation,
19218885Sdim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20218885Sdim *
21218885Sdim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22234353Sdim * or visit www.oracle.com if you need additional information or have any
23234353Sdim * questions.
24218885Sdim */
25218885Sdim
26218885Sdimpackage javax.lang.model.util;
27218885Sdim
28218885Sdimimport javax.lang.model.element.*;
29218885Sdimimport javax.annotation.processing.SupportedSourceVersion;
30218885Sdimimport static javax.lang.model.SourceVersion.*;
31218885Sdimimport javax.lang.model.SourceVersion;
32218885Sdim
33218885Sdim/**
34218885Sdim * A visitor of program elements based on their {@linkplain
35218885Sdim * ElementKind kind} with default behavior appropriate for the {@link
36218885Sdim * SourceVersion#RELEASE_9 RELEASE_9} source version.  For {@linkplain
37218885Sdim * Element elements} <tt><i>XYZ</i></tt> that may have more than one
38221345Sdim * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
39218885Sdim * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
40218885Sdim * first argument's kind.  The <tt>visit<i>XYZKind</i></tt> methods
41218885Sdim * call {@link #defaultAction defaultAction}, passing their arguments
42218885Sdim * to {@code defaultAction}'s corresponding parameters.
43218885Sdim *
44221345Sdim * <p> Methods in this class may be overridden subject to their
45221345Sdim * general contract.  Note that annotating methods in concrete
46221345Sdim * subclasses with {@link java.lang.Override @Override} will help
47221345Sdim * ensure that methods are overridden as intended.
48221345Sdim *
49221345Sdim * <p> <b>WARNING:</b> The {@code ElementVisitor} interface
50221345Sdim * implemented by this class may have methods added to it or the
51221345Sdim * {@code ElementKind} {@code enum} used in this case may have
52218885Sdim * constants added to it in the future to accommodate new, currently
53218885Sdim * unknown, language structures added to future versions of the
54218885Sdim * Java&trade; programming language.  Therefore, methods whose names
55218885Sdim * begin with {@code "visit"} may be added to this class in the
56218885Sdim * future; to avoid incompatibilities, classes which extend this class
57218885Sdim * should not declare any instance methods with names beginning with
58218885Sdim * {@code "visit"}.
59218885Sdim *
60218885Sdim * <p>When such a new visit method is added, the default
61218885Sdim * implementation in this class will be to call the {@link
62218885Sdim * #visitUnknown visitUnknown} method.  A new abstract element kind
63218885Sdim * visitor class will also be introduced to correspond to the new
64218885Sdim * language level; this visitor will have different default behavior
65218885Sdim * for the visit method in question.  When the new visitor is
66218885Sdim * introduced, all or portions of this visitor may be deprecated.
67218885Sdim *
68218885Sdim * @param <R> the return type of this visitor's methods.  Use {@link
69218885Sdim *            Void} for visitors that do not need to return results.
70218885Sdim * @param <P> the type of the additional parameter to this visitor's
71218885Sdim *            methods.  Use {@code Void} for visitors that do not need an
72218885Sdim *            additional parameter.
73218885Sdim *
74218885Sdim * @see ElementKindVisitor6
75218885Sdim * @see ElementKindVisitor7
76218885Sdim * @see ElementKindVisitor8
77218885Sdim * @since 1.9
78218885Sdim */
79218885Sdim@SupportedSourceVersion(RELEASE_9)
80218885Sdimpublic class ElementKindVisitor9<R, P> extends ElementKindVisitor8<R, P> {
81218885Sdim    /**
82218885Sdim     * Constructor for concrete subclasses; uses {@code null} for the
83218885Sdim     * default value.
84218885Sdim     */
85218885Sdim    protected ElementKindVisitor9() {
86218885Sdim        super(null);
87218885Sdim    }
88218885Sdim
89218885Sdim    /**
90218885Sdim     * Constructor for concrete subclasses; uses the argument for the
91218885Sdim     * default value.
92218885Sdim     *
93218885Sdim     * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
94218885Sdim     */
95218885Sdim    protected ElementKindVisitor9(R defaultValue) {
96218885Sdim        super(defaultValue);
97218885Sdim    }
98218885Sdim}
99218885Sdim