1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/classes/com/sun/source/doctree/DocTreeVisitor.java Wed Nov 14 17:23:10 2012 -0800 1.3 @@ -0,0 +1,87 @@ 1.4 +/* 1.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +package com.sun.source.doctree; 1.30 + 1.31 + 1.32 +/** 1.33 + * A visitor of trees, in the style of the visitor design pattern. 1.34 + * Classes implementing this interface are used to operate 1.35 + * on a tree when the kind of tree is unknown at compile time. 1.36 + * When a visitor is passed to an tree's {@link DocTree#accept 1.37 + * accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable 1.38 + * to that tree is invoked. 1.39 + * 1.40 + * <p> Classes implementing this interface may or may not throw a 1.41 + * {@code NullPointerException} if the additional parameter {@code p} 1.42 + * is {@code null}; see documentation of the implementing class for 1.43 + * details. 1.44 + * 1.45 + * <p> <b>WARNING:</b> It is possible that methods will be added to 1.46 + * this interface to accommodate new, currently unknown, doc comment 1.47 + * structures added to future versions of the Java™ programming 1.48 + * language. Therefore, visitor classes directly implementing this 1.49 + * interface may be source incompatible with future versions of the 1.50 + * platform. 1.51 + * 1.52 + * @param <R> the return type of this visitor's methods. Use {@link 1.53 + * Void} for visitors that do not need to return results. 1.54 + * @param <P> the type of the additional parameter to this visitor's 1.55 + * methods. Use {@code Void} for visitors that do not need an 1.56 + * additional parameter. 1.57 + * 1.58 + * @since 1.8 1.59 + */ 1.60 +public interface DocTreeVisitor<R,P> { 1.61 + R visitAttribute(AttributeTree node, P p); 1.62 + R visitAuthor(AuthorTree node, P p); 1.63 + R visitComment(CommentTree node, P p); 1.64 + R visitDeprecated(DeprecatedTree node, P p); 1.65 + R visitDocComment(DocCommentTree node, P p); 1.66 + R visitDocRoot(DocRootTree node, P p); 1.67 + R visitEndElement(EndElementTree node, P p); 1.68 + R visitEntity(EntityTree node, P p); 1.69 + R visitErroneous(ErroneousTree node, P p); 1.70 + R visitIdentifier(IdentifierTree node, P p); 1.71 + R visitInheritDoc(InheritDocTree node, P p); 1.72 + R visitLink(LinkTree node, P p); 1.73 + R visitLiteral(LiteralTree node, P p); 1.74 + R visitParam(ParamTree node, P p); 1.75 + R visitReference(ReferenceTree node, P p); 1.76 + R visitReturn(ReturnTree node, P p); 1.77 + R visitSee(SeeTree node, P p); 1.78 + R visitSerial(SerialTree node, P p); 1.79 + R visitSerialData(SerialDataTree node, P p); 1.80 + R visitSerialField(SerialFieldTree node, P p); 1.81 + R visitSince(SinceTree node, P p); 1.82 + R visitStartElement(StartElementTree node, P p); 1.83 + R visitText(TextTree node, P p); 1.84 + R visitThrows(ThrowsTree node, P p); 1.85 + R visitUnknownBlockTag(UnknownBlockTagTree node, P p); 1.86 + R visitUnknownInlineTag(UnknownInlineTagTree node, P p); 1.87 + R visitValue(ValueTree node, P p); 1.88 + R visitVersion(VersionTree node, P p); 1.89 + R visitOther(DocTree node, P p); 1.90 +}