1 /*
   2  * Copyright (c) 2011, 2013, 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.source.doctree;
  27 
  28 
  29 /**
  30  * A visitor of trees, in the style of the visitor design pattern.
  31  * Classes implementing this interface are used to operate
  32  * on a tree when the kind of tree is unknown at compile time.
  33  * When a visitor is passed to an tree's {@link DocTree#accept
  34  * accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
  35  * to that tree is invoked.
  36  *
  37  * <p> Classes implementing this interface may or may not throw a
  38  * {@code NullPointerException} if the additional parameter {@code p}
  39  * is {@code null}; see documentation of the implementing class for
  40  * details.
  41  *
  42  * <p> <b>WARNING:</b> It is possible that methods will be added to
  43  * this interface to accommodate new, currently unknown, doc comment
  44  * structures added to future versions of the Java&trade; programming
  45  * language.  Therefore, visitor classes directly implementing this
  46  * interface may be source incompatible with future versions of the
  47  * platform.
  48  *
  49  * @param <R> the return type of this visitor's methods.  Use {@link
  50  *            Void} for visitors that do not need to return results.
  51  * @param <P> the type of the additional parameter to this visitor's
  52  *            methods.  Use {@code Void} for visitors that do not need an
  53  *            additional parameter.
  54  *
  55  * @since 1.8
  56  */
  57 @jdk.Supported
  58 public interface DocTreeVisitor<R,P> {
  59     R visitAttribute(AttributeTree node, P p);
  60     R visitAuthor(AuthorTree node, P p);
  61     R visitComment(CommentTree node, P p);
  62     R visitDeprecated(DeprecatedTree node, P p);
  63     R visitDocComment(DocCommentTree node, P p);
  64     R visitDocRoot(DocRootTree node, P p);
  65     R visitEndElement(EndElementTree node, P p);
  66     R visitEntity(EntityTree node, P p);
  67     R visitErroneous(ErroneousTree node, P p);
  68     R visitIdentifier(IdentifierTree node, P p);
  69     R visitInheritDoc(InheritDocTree node, P p);
  70     R visitLink(LinkTree node, P p);
  71     R visitLiteral(LiteralTree node, P p);
  72     R visitParam(ParamTree node, P p);
  73     R visitReference(ReferenceTree node, P p);
  74     R visitReturn(ReturnTree node, P p);
  75     R visitSee(SeeTree node, P p);
  76     R visitSerial(SerialTree node, P p);
  77     R visitSerialData(SerialDataTree node, P p);
  78     R visitSerialField(SerialFieldTree node, P p);
  79     R visitSince(SinceTree node, P p);
  80     R visitStartElement(StartElementTree node, P p);
  81     R visitText(TextTree node, P p);
  82     R visitThrows(ThrowsTree node, P p);
  83     R visitUnknownBlockTag(UnknownBlockTagTree node, P p);
  84     R visitUnknownInlineTag(UnknownInlineTagTree node, P p);
  85     R visitValue(ValueTree node, P p);
  86     R visitVersion(VersionTree node, P p);
  87     R visitOther(DocTree node, P p);
  88 }