src/jdk.compiler/share/classes/com/sun/source/doctree/DocCommentTree.java

Print this page




  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.source.doctree;
  27 
  28 import java.util.ArrayList;
  29 import java.util.List;
  30 
  31 /**
  32  * The top level representation of a documentation comment.
  33  *
  34  * <p>
  35  * first-sentence body block-tags
  36  *
  37  * @since 1.8
  38  */
  39 @jdk.Exported
  40 public interface DocCommentTree extends DocTree {
  41     /**
  42      * Returns the first sentence of a documentation comment.
  43      * @return the first sentence of a documentation comment
  44      */
  45     List<? extends DocTree> getFirstSentence();
  46 
  47     /**
  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      *
  52      * @since 9
  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     }


  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.source.doctree;
  27 
  28 import java.util.ArrayList;
  29 import java.util.List;
  30 
  31 /**
  32  * The top level representation of a documentation comment.
  33  *
  34  * <p>
  35  * first-sentence body block-tags
  36  *
  37  * @since 1.8
  38  */

  39 public interface DocCommentTree extends DocTree {
  40     /**
  41      * Returns the first sentence of a documentation comment.
  42      * @return the first sentence of a documentation comment
  43      */
  44     List<? extends DocTree> getFirstSentence();
  45 
  46     /**
  47      * Returns the entire body of a documentation comment, appearing
  48      * before any block tags, including the first sentence.
  49      * @return body of a documentation comment first sentence inclusive
  50      *
  51      * @since 9
  52      */
  53     default List<? extends DocTree> getFullBody() {
  54         ArrayList<DocTree> bodyList = new ArrayList<>();
  55         bodyList.addAll(getFirstSentence());
  56         bodyList.addAll(getBody());
  57         return bodyList;
  58     }