574N/A/*
850N/A * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
574N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
574N/A *
574N/A * This code is free software; you can redistribute it and/or modify it
574N/A * under the terms of the GNU General Public License version 2 only, as
574N/A * published by the Free Software Foundation. Oracle designates this
574N/A * particular file as subject to the "Classpath" exception as provided
574N/A * by Oracle in the LICENSE file that accompanied this code.
574N/A *
574N/A * This code is distributed in the hope that it will be useful, but WITHOUT
574N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
574N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
574N/A * version 2 for more details (a copy is included in the LICENSE file that
574N/A * accompanied this code).
574N/A *
574N/A * You should have received a copy of the GNU General Public License version
574N/A * 2 along with this work; if not, write to the Free Software Foundation,
574N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
574N/A *
574N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
574N/A * or visit www.oracle.com if you need additional information or have any
574N/A * questions.
574N/A */
574N/A
574N/Apackage javax.lang.model.util;
574N/A
574N/Aimport javax.lang.model.element.*;
574N/Aimport javax.annotation.processing.SupportedSourceVersion;
574N/Aimport static javax.lang.model.element.ElementKind.*;
574N/Aimport javax.lang.model.SourceVersion;
574N/Aimport static javax.lang.model.SourceVersion.*;
574N/A
574N/A/**
574N/A * A simple visitor of program elements with default behavior
574N/A * appropriate for the {@link SourceVersion#RELEASE_7 RELEASE_7}
574N/A * source version.
574N/A *
850N/A * Visit methods corresponding to {@code RELEASE_7} and earlier
850N/A * language constructs call {@link #defaultAction defaultAction},
850N/A * passing their arguments to {@code defaultAction}'s corresponding
850N/A * parameters.
574N/A *
574N/A * <p> Methods in this class may be overridden subject to their
574N/A * general contract. Note that annotating methods in concrete
574N/A * subclasses with {@link java.lang.Override @Override} will help
574N/A * ensure that methods are overridden as intended.
574N/A *
574N/A * <p> <b>WARNING:</b> The {@code ElementVisitor} interface
574N/A * implemented by this class may have methods added to it in the
574N/A * future to accommodate new, currently unknown, language structures
574N/A * added to future versions of the Java&trade; programming language.
574N/A * Therefore, methods whose names begin with {@code "visit"} may be
574N/A * added to this class in the future; to avoid incompatibilities,
574N/A * classes which extend this class should not declare any instance
574N/A * methods with names beginning with {@code "visit"}.
574N/A *
574N/A * <p>When such a new visit method is added, the default
574N/A * implementation in this class will be to call the {@link
574N/A * #visitUnknown visitUnknown} method. A new simple element visitor
574N/A * class will also be introduced to correspond to the new language
574N/A * level; this visitor will have different default behavior for the
574N/A * visit method in question. When the new visitor is introduced, all
574N/A * or portions of this visitor may be deprecated.
574N/A *
574N/A * @param <R> the return type of this visitor's methods. Use {@code Void}
574N/A * for visitors that do not need to return results.
574N/A * @param <P> the type of the additional parameter to this visitor's methods. Use {@code Void}
574N/A * for visitors that do not need an additional parameter.
574N/A *
574N/A * @see SimpleElementVisitor6
574N/A * @since 1.7
574N/A */
574N/A@SupportedSourceVersion(RELEASE_7)
574N/Apublic class SimpleElementVisitor7<R, P> extends SimpleElementVisitor6<R, P> {
574N/A /**
574N/A * Constructor for concrete subclasses; uses {@code null} for the
574N/A * default value.
574N/A */
574N/A protected SimpleElementVisitor7(){
574N/A super(null);
574N/A }
574N/A
574N/A /**
574N/A * Constructor for concrete subclasses; uses the argument for the
574N/A * default value.
574N/A *
574N/A * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
574N/A */
574N/A protected SimpleElementVisitor7(R defaultValue){
574N/A super(defaultValue);
574N/A }
850N/A
850N/A /**
850N/A * This implementation calls {@code defaultAction}.
850N/A *
850N/A * @param e {@inheritDoc}
850N/A * @param p {@inheritDoc}
850N/A * @return the result of {@code defaultAction}
850N/A */
850N/A @Override
850N/A public R visitVariable(VariableElement e, P p) {
850N/A return defaultAction(e, p);
850N/A }
574N/A}