Path: blob/master/src/jdk.compiler/share/classes/com/sun/source/doctree/DocCommentTree.java
41175 views
/*1* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.source.doctree;2627import java.util.ArrayList;28import java.util.Collections;29import java.util.List;3031/**32* The top-level representation of a documentation comment.33*34* <pre>35* first-sentence body block-tags36* </pre>37*38* @since 1.839*/40public interface DocCommentTree extends DocTree {41/**42* Returns the first sentence of a documentation comment.43* @return the first sentence of a documentation comment44*/45List<? extends DocTree> getFirstSentence();4647/**48* Returns the entire body of a documentation comment, appearing49* before any block tags, including the first sentence.50* @return body of a documentation comment first sentence inclusive51*52* @since 953*/54default List<? extends DocTree> getFullBody() {55ArrayList<DocTree> bodyList = new ArrayList<>();56bodyList.addAll(getFirstSentence());57bodyList.addAll(getBody());58return bodyList;59}6061/**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 comment65*/66List<? extends DocTree> getBody();6768/**69* Returns the block tags for a documentation comment.70* @return the block tags of a documentation comment71*/72List<? extends DocTree> getBlockTags();7374/**75* Returns a list of trees containing the content (if any) preceding76* the content of the documentation comment.77* When the {@code DocCommentTree} has been read from a documentation78* comment in a Java source file, the list will be empty.79* When the {@code DocCommentTree} has been read from an HTML file, this80* represents the content from the beginning of the file up to and81* including the {@code <body>} tag.82*83* @implSpec This implementation returns an empty list.84*85* @return the list of trees86* @since 1087*/88default List<? extends DocTree> getPreamble() {89return Collections.emptyList();90}9192/**93* Returns a list of trees containing the content (if any) following the94* content of the documentation comment.95* When the {@code DocCommentTree} has been read from a documentation96* comment in a Java source file, the list will be empty.97* When {@code DocCommentTree} has been read from an HTML file, this98* represents the content from the {@code </body>} tag to the end of file.99*100* @implSpec This implementation returns an empty list.101*102* @return the list of trees103* @since 10104*/105default List<? extends DocTree> getPostamble() {106return Collections.emptyList();107}108}109110111