author | rkennke |
Fri, 12 Oct 2018 16:25:24 +0200 | |
changeset 52107 | 0c1e44da019c |
parent 48028 | 9e022f580a9d |
permissions | -rw-r--r-- |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
1 |
/* |
48028
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
4 |
* |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
10 |
* |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
15 |
* accompanied this code). |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
16 |
* |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
20 |
* |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
23 |
* questions. |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
24 |
*/ |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
25 |
|
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
26 |
package com.sun.source.doctree; |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
27 |
|
33360 | 28 |
import java.util.ArrayList; |
48028
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
29 |
import java.util.Collections; |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
30 |
import java.util.List; |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
31 |
|
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
32 |
/** |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
33 |
* The top level representation of a documentation comment. |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
34 |
* |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
35 |
* <p> |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
36 |
* first-sentence body block-tags |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
37 |
* |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
38 |
* @since 1.8 |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
39 |
*/ |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
40 |
public interface DocCommentTree extends DocTree { |
25287 | 41 |
/** |
42 |
* Returns the first sentence of a documentation comment. |
|
43 |
* @return the first sentence of a documentation comment |
|
44 |
*/ |
|
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
45 |
List<? extends DocTree> getFirstSentence(); |
25287 | 46 |
|
47 |
/** |
|
33360 | 48 |
* Returns the entire body of a documentation comment, appearing |
49 |
* before any block tags, including the first sentence. |
|
50 |
* @return body of a documentation comment first sentence inclusive |
|
51 |
* |
|
34912
954fa9df99c7
8146572: Update "@since 1.9" to "@since 9" to match java.version.specification [langtools]
jjg
parents:
33360
diff
changeset
|
52 |
* @since 9 |
33360 | 53 |
*/ |
54 |
default List<? extends DocTree> getFullBody() { |
|
55 |
ArrayList<DocTree> bodyList = new ArrayList<>(); |
|
56 |
bodyList.addAll(getFirstSentence()); |
|
57 |
bodyList.addAll(getBody()); |
|
58 |
return bodyList; |
|
59 |
} |
|
60 |
||
61 |
/** |
|
25287 | 62 |
* Returns the body of a documentation comment, |
63 |
* appearing after the first sentence, and before any block tags. |
|
64 |
* @return the body of a documentation comment |
|
65 |
*/ |
|
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
66 |
List<? extends DocTree> getBody(); |
25287 | 67 |
|
68 |
/** |
|
69 |
* Returns the block tags for a documentation comment. |
|
70 |
* @return the block tags of a documentation comment |
|
71 |
*/ |
|
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
72 |
List<? extends DocTree> getBlockTags(); |
48028
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
73 |
|
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
74 |
/** |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
75 |
* Returns a list of trees containing the content (if any) preceding |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
76 |
* the content of the documentation comment. |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
77 |
* When the {@code DocCommentTree} has been read from a documentation |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
78 |
* comment in a Java source file, the list will be empty. |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
79 |
* When the {@code DocCommentTree} has been read from an HTML file, this |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
80 |
* represents the content from the beginning of the file up to and |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
81 |
* including the {@code <body>} tag. |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
82 |
* |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
83 |
* @implSpec This implementation returns an empty list. |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
84 |
* |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
85 |
* @return the list of trees |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
86 |
* @since 10 |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
87 |
*/ |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
88 |
default List<? extends DocTree> getPreamble() { |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
89 |
return Collections.emptyList(); |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
90 |
} |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
91 |
|
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
92 |
/** |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
93 |
* Returns a list of trees containing the content (if any) following the |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
94 |
* content of the documentation comment. |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
95 |
* When the {@code DocCommentTree} has been read from a documentation |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
96 |
* comment in a Java source file, the list will be empty. |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
97 |
* When {@code DocCommentTree} has been read from an HTML file, this |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
98 |
* represents the content from the {@code </body>} tag to the end of file. |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
99 |
* |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
100 |
* @implSpec This implementation returns an empty list. |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
101 |
* |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
102 |
* @return the list of trees |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
103 |
* @since 10 |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
104 |
*/ |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
105 |
default List<? extends DocTree> getPostamble() { |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
106 |
return Collections.emptyList(); |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47216
diff
changeset
|
107 |
} |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
108 |
} |