1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/classes/com/sun/source/doctree/DocTree.java Wed Apr 27 01:34:52 2016 +0800 1.3 @@ -0,0 +1,256 @@ 1.4 +/* 1.5 + * Copyright (c) 2011, 2013, 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 + * Common interface for all nodes in a documentation syntax tree. 1.33 + * 1.34 + * @since 1.8 1.35 + */ 1.36 +@jdk.Exported 1.37 +public interface DocTree { 1.38 + @jdk.Exported 1.39 + enum Kind { 1.40 + /** 1.41 + * Used for instances of {@link AttributeTree} 1.42 + * representing an HTML attribute. 1.43 + */ 1.44 + ATTRIBUTE, 1.45 + 1.46 + /** 1.47 + * Used for instances of {@link AuthorTree} 1.48 + * representing an @author tag. 1.49 + */ 1.50 + AUTHOR("author"), 1.51 + 1.52 + /** 1.53 + * Used for instances of {@link LiteralTree} 1.54 + * representing an @code tag. 1.55 + */ 1.56 + CODE("code"), 1.57 + 1.58 + /** 1.59 + * Used for instances of {@link CommentTree} 1.60 + * representing an HTML comment. 1.61 + */ 1.62 + COMMENT, 1.63 + 1.64 + /** 1.65 + * Used for instances of {@link DeprecatedTree} 1.66 + * representing an @deprecated tag. 1.67 + */ 1.68 + DEPRECATED("deprecated"), 1.69 + 1.70 + /** 1.71 + * Used for instances of {@link DocCommentTree} 1.72 + * representing a complete doc comment. 1.73 + */ 1.74 + DOC_COMMENT, 1.75 + 1.76 + /** 1.77 + * Used for instances of {@link DocRootTree} 1.78 + * representing an @docRoot tag. 1.79 + */ 1.80 + DOC_ROOT("docRoot"), 1.81 + 1.82 + /** 1.83 + * Used for instances of {@link EndElementTree} 1.84 + * representing the end of an HTML element. 1.85 + */ 1.86 + END_ELEMENT, 1.87 + 1.88 + /** 1.89 + * Used for instances of {@link EntityTree} 1.90 + * representing an HTML entity. 1.91 + */ 1.92 + ENTITY, 1.93 + 1.94 + /** 1.95 + * Used for instances of {@link ErroneousTree} 1.96 + * representing some invalid text. 1.97 + */ 1.98 + ERRONEOUS, 1.99 + 1.100 + /** 1.101 + * Used for instances of {@link ThrowsTree} 1.102 + * representing an @exception tag. 1.103 + */ 1.104 + EXCEPTION("exception"), 1.105 + 1.106 + /** 1.107 + * Used for instances of {@link IdentifierTree} 1.108 + * representing an identifier. 1.109 + */ 1.110 + IDENTIFIER, 1.111 + 1.112 + /** 1.113 + * Used for instances of {@link InheritDocTree} 1.114 + * representing an @inheritDoc tag. 1.115 + */ 1.116 + INHERIT_DOC("inheritDoc"), 1.117 + 1.118 + /** 1.119 + * Used for instances of {@link LinkTree} 1.120 + * representing an @link tag. 1.121 + */ 1.122 + LINK("link"), 1.123 + 1.124 + /** 1.125 + * Used for instances of {@link LinkTree} 1.126 + * representing an @linkplain tag. 1.127 + */ 1.128 + LINK_PLAIN("linkplain"), 1.129 + 1.130 + /** 1.131 + * Used for instances of {@link LiteralTree} 1.132 + * representing an @literal tag. 1.133 + */ 1.134 + LITERAL("literal"), 1.135 + 1.136 + /** 1.137 + * Used for instances of {@link ParamTree} 1.138 + * representing an @param tag. 1.139 + */ 1.140 + PARAM("param"), 1.141 + 1.142 + /** 1.143 + * Used for instances of {@link ReferenceTree} 1.144 + * representing a reference to a element in the 1.145 + * Java programming language. 1.146 + */ 1.147 + REFERENCE, 1.148 + 1.149 + /** 1.150 + * Used for instances of {@link ReturnTree} 1.151 + * representing an @return tag. 1.152 + */ 1.153 + RETURN("return"), 1.154 + 1.155 + /** 1.156 + * Used for instances of {@link SeeTree} 1.157 + * representing an @see tag. 1.158 + */ 1.159 + SEE("see"), 1.160 + 1.161 + /** 1.162 + * Used for instances of {@link SerialTree} 1.163 + * representing an @serial tag. 1.164 + */ 1.165 + SERIAL("serial"), 1.166 + 1.167 + /** 1.168 + * Used for instances of {@link SerialDataTree} 1.169 + * representing an @serialData tag. 1.170 + */ 1.171 + SERIAL_DATA("serialData"), 1.172 + 1.173 + /** 1.174 + * Used for instances of {@link SerialFieldTree} 1.175 + * representing an @serialField tag. 1.176 + */ 1.177 + SERIAL_FIELD("serialField"), 1.178 + 1.179 + /** 1.180 + * Used for instances of {@link SinceTree} 1.181 + * representing an @since tag. 1.182 + */ 1.183 + SINCE("since"), 1.184 + 1.185 + /** 1.186 + * Used for instances of {@link EndElementTree} 1.187 + * representing the start of an HTML element. 1.188 + */ 1.189 + START_ELEMENT, 1.190 + 1.191 + /** 1.192 + * Used for instances of {@link TextTree} 1.193 + * representing some documentation text. 1.194 + */ 1.195 + TEXT, 1.196 + 1.197 + /** 1.198 + * Used for instances of {@link ThrowsTree} 1.199 + * representing an @throws tag. 1.200 + */ 1.201 + THROWS("throws"), 1.202 + 1.203 + /** 1.204 + * Used for instances of {@link UnknownBlockTagTree} 1.205 + * representing an unknown block tag. 1.206 + */ 1.207 + UNKNOWN_BLOCK_TAG, 1.208 + 1.209 + /** 1.210 + * Used for instances of {@link UnknownInlineTagTree} 1.211 + * representing an unknown inline tag. 1.212 + */ 1.213 + UNKNOWN_INLINE_TAG, 1.214 + 1.215 + /** 1.216 + * Used for instances of {@link ValueTree} 1.217 + * representing an @value tag. 1.218 + */ 1.219 + VALUE("value"), 1.220 + 1.221 + /** 1.222 + * Used for instances of {@link VersionTree} 1.223 + * representing an @version tag. 1.224 + */ 1.225 + VERSION("version"), 1.226 + 1.227 + /** 1.228 + * An implementation-reserved node. This is the not the node 1.229 + * you are looking for. 1.230 + */ 1.231 + OTHER; 1.232 + 1.233 + public final String tagName; 1.234 + 1.235 + Kind() { 1.236 + tagName = null; 1.237 + } 1.238 + 1.239 + Kind(String tagName) { 1.240 + this.tagName = tagName; 1.241 + } 1.242 + }; 1.243 + 1.244 + /** 1.245 + * Gets the kind of this tree. 1.246 + * 1.247 + * @return the kind of this tree. 1.248 + */ 1.249 + Kind getKind(); 1.250 + 1.251 + /** 1.252 + * Accept method used to implement the visitor pattern. The 1.253 + * visitor pattern is used to implement operations on trees. 1.254 + * 1.255 + * @param <R> result type of this operation. 1.256 + * @param <D> type of additional data. 1.257 + */ 1.258 + <R, D> R accept(DocTreeVisitor<R,D> visitor, D data); 1.259 +}