Thu, 31 Aug 2017 15:17:03 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | package com.sun.source.doctree; |
aoqi@0 | 27 | |
aoqi@0 | 28 | /** |
aoqi@0 | 29 | * Common interface for all nodes in a documentation syntax tree. |
aoqi@0 | 30 | * |
aoqi@0 | 31 | * @since 1.8 |
aoqi@0 | 32 | */ |
aoqi@0 | 33 | @jdk.Exported |
aoqi@0 | 34 | public interface DocTree { |
aoqi@0 | 35 | @jdk.Exported |
aoqi@0 | 36 | enum Kind { |
aoqi@0 | 37 | /** |
aoqi@0 | 38 | * Used for instances of {@link AttributeTree} |
aoqi@0 | 39 | * representing an HTML attribute. |
aoqi@0 | 40 | */ |
aoqi@0 | 41 | ATTRIBUTE, |
aoqi@0 | 42 | |
aoqi@0 | 43 | /** |
aoqi@0 | 44 | * Used for instances of {@link AuthorTree} |
aoqi@0 | 45 | * representing an @author tag. |
aoqi@0 | 46 | */ |
aoqi@0 | 47 | AUTHOR("author"), |
aoqi@0 | 48 | |
aoqi@0 | 49 | /** |
aoqi@0 | 50 | * Used for instances of {@link LiteralTree} |
aoqi@0 | 51 | * representing an @code tag. |
aoqi@0 | 52 | */ |
aoqi@0 | 53 | CODE("code"), |
aoqi@0 | 54 | |
aoqi@0 | 55 | /** |
aoqi@0 | 56 | * Used for instances of {@link CommentTree} |
aoqi@0 | 57 | * representing an HTML comment. |
aoqi@0 | 58 | */ |
aoqi@0 | 59 | COMMENT, |
aoqi@0 | 60 | |
aoqi@0 | 61 | /** |
aoqi@0 | 62 | * Used for instances of {@link DeprecatedTree} |
aoqi@0 | 63 | * representing an @deprecated tag. |
aoqi@0 | 64 | */ |
aoqi@0 | 65 | DEPRECATED("deprecated"), |
aoqi@0 | 66 | |
aoqi@0 | 67 | /** |
aoqi@0 | 68 | * Used for instances of {@link DocCommentTree} |
aoqi@0 | 69 | * representing a complete doc comment. |
aoqi@0 | 70 | */ |
aoqi@0 | 71 | DOC_COMMENT, |
aoqi@0 | 72 | |
aoqi@0 | 73 | /** |
aoqi@0 | 74 | * Used for instances of {@link DocRootTree} |
aoqi@0 | 75 | * representing an @docRoot tag. |
aoqi@0 | 76 | */ |
aoqi@0 | 77 | DOC_ROOT("docRoot"), |
aoqi@0 | 78 | |
aoqi@0 | 79 | /** |
aoqi@0 | 80 | * Used for instances of {@link EndElementTree} |
aoqi@0 | 81 | * representing the end of an HTML element. |
aoqi@0 | 82 | */ |
aoqi@0 | 83 | END_ELEMENT, |
aoqi@0 | 84 | |
aoqi@0 | 85 | /** |
aoqi@0 | 86 | * Used for instances of {@link EntityTree} |
aoqi@0 | 87 | * representing an HTML entity. |
aoqi@0 | 88 | */ |
aoqi@0 | 89 | ENTITY, |
aoqi@0 | 90 | |
aoqi@0 | 91 | /** |
aoqi@0 | 92 | * Used for instances of {@link ErroneousTree} |
aoqi@0 | 93 | * representing some invalid text. |
aoqi@0 | 94 | */ |
aoqi@0 | 95 | ERRONEOUS, |
aoqi@0 | 96 | |
aoqi@0 | 97 | /** |
aoqi@0 | 98 | * Used for instances of {@link ThrowsTree} |
aoqi@0 | 99 | * representing an @exception tag. |
aoqi@0 | 100 | */ |
aoqi@0 | 101 | EXCEPTION("exception"), |
aoqi@0 | 102 | |
aoqi@0 | 103 | /** |
aoqi@0 | 104 | * Used for instances of {@link IdentifierTree} |
aoqi@0 | 105 | * representing an identifier. |
aoqi@0 | 106 | */ |
aoqi@0 | 107 | IDENTIFIER, |
aoqi@0 | 108 | |
aoqi@0 | 109 | /** |
aoqi@0 | 110 | * Used for instances of {@link InheritDocTree} |
aoqi@0 | 111 | * representing an @inheritDoc tag. |
aoqi@0 | 112 | */ |
aoqi@0 | 113 | INHERIT_DOC("inheritDoc"), |
aoqi@0 | 114 | |
aoqi@0 | 115 | /** |
aoqi@0 | 116 | * Used for instances of {@link LinkTree} |
aoqi@0 | 117 | * representing an @link tag. |
aoqi@0 | 118 | */ |
aoqi@0 | 119 | LINK("link"), |
aoqi@0 | 120 | |
aoqi@0 | 121 | /** |
aoqi@0 | 122 | * Used for instances of {@link LinkTree} |
aoqi@0 | 123 | * representing an @linkplain tag. |
aoqi@0 | 124 | */ |
aoqi@0 | 125 | LINK_PLAIN("linkplain"), |
aoqi@0 | 126 | |
aoqi@0 | 127 | /** |
aoqi@0 | 128 | * Used for instances of {@link LiteralTree} |
aoqi@0 | 129 | * representing an @literal tag. |
aoqi@0 | 130 | */ |
aoqi@0 | 131 | LITERAL("literal"), |
aoqi@0 | 132 | |
aoqi@0 | 133 | /** |
aoqi@0 | 134 | * Used for instances of {@link ParamTree} |
aoqi@0 | 135 | * representing an @param tag. |
aoqi@0 | 136 | */ |
aoqi@0 | 137 | PARAM("param"), |
aoqi@0 | 138 | |
aoqi@0 | 139 | /** |
aoqi@0 | 140 | * Used for instances of {@link ReferenceTree} |
aoqi@0 | 141 | * representing a reference to a element in the |
aoqi@0 | 142 | * Java programming language. |
aoqi@0 | 143 | */ |
aoqi@0 | 144 | REFERENCE, |
aoqi@0 | 145 | |
aoqi@0 | 146 | /** |
aoqi@0 | 147 | * Used for instances of {@link ReturnTree} |
aoqi@0 | 148 | * representing an @return tag. |
aoqi@0 | 149 | */ |
aoqi@0 | 150 | RETURN("return"), |
aoqi@0 | 151 | |
aoqi@0 | 152 | /** |
aoqi@0 | 153 | * Used for instances of {@link SeeTree} |
aoqi@0 | 154 | * representing an @see tag. |
aoqi@0 | 155 | */ |
aoqi@0 | 156 | SEE("see"), |
aoqi@0 | 157 | |
aoqi@0 | 158 | /** |
aoqi@0 | 159 | * Used for instances of {@link SerialTree} |
aoqi@0 | 160 | * representing an @serial tag. |
aoqi@0 | 161 | */ |
aoqi@0 | 162 | SERIAL("serial"), |
aoqi@0 | 163 | |
aoqi@0 | 164 | /** |
aoqi@0 | 165 | * Used for instances of {@link SerialDataTree} |
aoqi@0 | 166 | * representing an @serialData tag. |
aoqi@0 | 167 | */ |
aoqi@0 | 168 | SERIAL_DATA("serialData"), |
aoqi@0 | 169 | |
aoqi@0 | 170 | /** |
aoqi@0 | 171 | * Used for instances of {@link SerialFieldTree} |
aoqi@0 | 172 | * representing an @serialField tag. |
aoqi@0 | 173 | */ |
aoqi@0 | 174 | SERIAL_FIELD("serialField"), |
aoqi@0 | 175 | |
aoqi@0 | 176 | /** |
aoqi@0 | 177 | * Used for instances of {@link SinceTree} |
aoqi@0 | 178 | * representing an @since tag. |
aoqi@0 | 179 | */ |
aoqi@0 | 180 | SINCE("since"), |
aoqi@0 | 181 | |
aoqi@0 | 182 | /** |
aoqi@0 | 183 | * Used for instances of {@link EndElementTree} |
aoqi@0 | 184 | * representing the start of an HTML element. |
aoqi@0 | 185 | */ |
aoqi@0 | 186 | START_ELEMENT, |
aoqi@0 | 187 | |
aoqi@0 | 188 | /** |
aoqi@0 | 189 | * Used for instances of {@link TextTree} |
aoqi@0 | 190 | * representing some documentation text. |
aoqi@0 | 191 | */ |
aoqi@0 | 192 | TEXT, |
aoqi@0 | 193 | |
aoqi@0 | 194 | /** |
aoqi@0 | 195 | * Used for instances of {@link ThrowsTree} |
aoqi@0 | 196 | * representing an @throws tag. |
aoqi@0 | 197 | */ |
aoqi@0 | 198 | THROWS("throws"), |
aoqi@0 | 199 | |
aoqi@0 | 200 | /** |
aoqi@0 | 201 | * Used for instances of {@link UnknownBlockTagTree} |
aoqi@0 | 202 | * representing an unknown block tag. |
aoqi@0 | 203 | */ |
aoqi@0 | 204 | UNKNOWN_BLOCK_TAG, |
aoqi@0 | 205 | |
aoqi@0 | 206 | /** |
aoqi@0 | 207 | * Used for instances of {@link UnknownInlineTagTree} |
aoqi@0 | 208 | * representing an unknown inline tag. |
aoqi@0 | 209 | */ |
aoqi@0 | 210 | UNKNOWN_INLINE_TAG, |
aoqi@0 | 211 | |
aoqi@0 | 212 | /** |
aoqi@0 | 213 | * Used for instances of {@link ValueTree} |
aoqi@0 | 214 | * representing an @value tag. |
aoqi@0 | 215 | */ |
aoqi@0 | 216 | VALUE("value"), |
aoqi@0 | 217 | |
aoqi@0 | 218 | /** |
aoqi@0 | 219 | * Used for instances of {@link VersionTree} |
aoqi@0 | 220 | * representing an @version tag. |
aoqi@0 | 221 | */ |
aoqi@0 | 222 | VERSION("version"), |
aoqi@0 | 223 | |
aoqi@0 | 224 | /** |
aoqi@0 | 225 | * An implementation-reserved node. This is the not the node |
aoqi@0 | 226 | * you are looking for. |
aoqi@0 | 227 | */ |
aoqi@0 | 228 | OTHER; |
aoqi@0 | 229 | |
aoqi@0 | 230 | public final String tagName; |
aoqi@0 | 231 | |
aoqi@0 | 232 | Kind() { |
aoqi@0 | 233 | tagName = null; |
aoqi@0 | 234 | } |
aoqi@0 | 235 | |
aoqi@0 | 236 | Kind(String tagName) { |
aoqi@0 | 237 | this.tagName = tagName; |
aoqi@0 | 238 | } |
aoqi@0 | 239 | }; |
aoqi@0 | 240 | |
aoqi@0 | 241 | /** |
aoqi@0 | 242 | * Gets the kind of this tree. |
aoqi@0 | 243 | * |
aoqi@0 | 244 | * @return the kind of this tree. |
aoqi@0 | 245 | */ |
aoqi@0 | 246 | Kind getKind(); |
aoqi@0 | 247 | |
aoqi@0 | 248 | /** |
aoqi@0 | 249 | * Accept method used to implement the visitor pattern. The |
aoqi@0 | 250 | * visitor pattern is used to implement operations on trees. |
aoqi@0 | 251 | * |
aoqi@0 | 252 | * @param <R> result type of this operation. |
aoqi@0 | 253 | * @param <D> type of additional data. |
aoqi@0 | 254 | */ |
aoqi@0 | 255 | <R, D> R accept(DocTreeVisitor<R,D> visitor, D data); |
aoqi@0 | 256 | } |