com.sun.javadoc.Doc.firstSentenceTags()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(181)

本文整理了Java中com.sun.javadoc.Doc.firstSentenceTags()方法的一些代码示例,展示了Doc.firstSentenceTags()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Doc.firstSentenceTags()方法的具体详情如下:
包路径:com.sun.javadoc.Doc
类名称:Doc
方法名:firstSentenceTags

Doc.firstSentenceTags介绍

[英]Return the first sentence of the comment as an array of tags. Includes inline tags (i.e. {@link reference} tags) but not block tags. Each section of plain text is represented as a Tagof Tag#kind() "Text". Inline tags are represented as a SeeTag of kind "@see" and name "@link".

If the locale is English language, the first sentence is determined by the rules described in the Java Language Specification (first version): "This sentence ends at the first period that is followed by a blank, tab, or line terminator or at the first tagline.", in addition a line will be terminated by block HTML tags: <p> </p> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <pre> or </pre>. If the locale is not English, the sentence end will be determined by BreakIterator#getSentenceInstance(Locale).
[中]将注释的第一句作为标记数组返回。包括内联标记(即{@link reference}标记),但不包括块标记。纯文本的每一部分都表示为Tagof标记#kind()“text”。内联标记表示为类型为“@see”和名称为“@link”的SeeTag。
如果语言环境是英语,则第一句话由Java语言规范(第一版)中描述的规则确定:“此句在第一个句点结束,后面是空白、制表符或行结束符,或在第一个标记行结束。”,此外,一行将由块HTML标记终止:<p><p><h1><h2><h3><h4><h5><h6><hr><pre>或</pre>。如果语言环境不是英语,句子的结尾将由BreakIterator#getSentenceInstance(语言环境)确定。

代码示例

代码示例来源:origin: konsoletyper/teavm-javac

  1. /**
  2. * Add the index comment.
  3. *
  4. * @param member the member being documented
  5. * @param contentTree the content tree to which the comment will be added
  6. */
  7. protected void addIndexComment(Doc member, Content contentTree) {
  8. addIndexComment(member, member.firstSentenceTags(), contentTree);
  9. }

代码示例来源:origin: konsoletyper/teavm-javac

  1. /**
  2. * Adds the summary content.
  3. *
  4. * @param doc the doc for which the summary will be generated
  5. * @param htmltree the documentation tree to which the summary will be added
  6. */
  7. public void addSummaryComment(Doc doc, Content htmltree) {
  8. addSummaryComment(doc, doc.firstSentenceTags(), htmltree);
  9. }

代码示例来源:origin: uk.org.retep.doclet/core

  1. public void printSummaryComment( Doc doc )
  2. {
  3. printSummaryComment( doc, doc.firstSentenceTags() );
  4. }

代码示例来源:origin: uk.org.retep.doclet/core

  1. public void printSummaryDeprecatedComment( Doc doc )
  2. {
  3. printCommentTags( doc, doc.firstSentenceTags(), true, true );
  4. }

代码示例来源:origin: uk.org.retep.doclet/core

  1. protected void printIndexComment(Doc member) {
  2. printIndexComment(member, member.firstSentenceTags());
  3. }

代码示例来源:origin: org.apache.axis2/axis2-transport-testkit

  1. private static String getFirstSentence(Doc doc) {
  2. Tag[] tags = doc.firstSentenceTags();
  3. if (tags.length == 0) {
  4. return null;
  5. }
  6. StringBuilder buffer = new StringBuilder();
  7. for (Tag tag : tags) {
  8. if (tag instanceof SeeTag) {
  9. buffer.append("{");
  10. buffer.append(tag.name());
  11. buffer.append(" ");
  12. buffer.append(((SeeTag)tag).referencedClassName());
  13. buffer.append("}");
  14. } else {
  15. buffer.append(tag.text());
  16. }
  17. }
  18. return buffer.toString();
  19. }

代码示例来源:origin: org.apache.axis2.transport/axis2-transport-testkit

  1. private static String getFirstSentence(Doc doc) {
  2. Tag[] tags = doc.firstSentenceTags();
  3. if (tags.length == 0) {
  4. return null;
  5. }
  6. StringBuilder buffer = new StringBuilder();
  7. for (Tag tag : tags) {
  8. if (tag instanceof SeeTag) {
  9. buffer.append("{");
  10. buffer.append(tag.name());
  11. buffer.append(" ");
  12. buffer.append(((SeeTag)tag).referencedClassName());
  13. buffer.append("}");
  14. } else {
  15. buffer.append(tag.text());
  16. }
  17. }
  18. return buffer.toString();
  19. }

代码示例来源:origin: apache/axis2-java

  1. private static String getFirstSentence(Doc doc) {
  2. Tag[] tags = doc.firstSentenceTags();
  3. if (tags.length == 0) {
  4. return null;
  5. }
  6. StringBuilder buffer = new StringBuilder();
  7. for (Tag tag : tags) {
  8. if (tag instanceof SeeTag) {
  9. buffer.append("{");
  10. buffer.append(tag.name());
  11. buffer.append(" ");
  12. buffer.append(((SeeTag)tag).referencedClassName());
  13. buffer.append("}");
  14. } else {
  15. buffer.append(tag.text());
  16. }
  17. }
  18. return buffer.toString();
  19. }

代码示例来源:origin: broadgsa/gatk

  1. /**
  2. * Renders all the help text required for a given name.
  3. * @param resourceText resource text properties
  4. * @param elementName element name to use as the key
  5. * @param element Doc element to process.
  6. */
  7. private void renderHelpText(final Properties resourceText, final String elementName, final Doc element) {
  8. StringBuilder summaryBuilder = new StringBuilder();
  9. for(Tag tag: element.firstSentenceTags())
  10. summaryBuilder.append(tag.text());
  11. String summary = summaryBuilder.toString();
  12. String description = element.commentText();
  13. // this might seem unnecessary, but the GATK command line program uses this tag to determine the version when running
  14. if(absoluteVersion != null)
  15. resourceText.setProperty(String.format("%s.%s",elementName,VERSION_TAGLET_NAME),absoluteVersion);
  16. // Write out an alternate element summary, if exists.
  17. resourceText.setProperty(String.format("%s.%s",elementName,SUMMARY_TAGLET_NAME),formatText(summary));
  18. // Write out an alternate description, if present.
  19. resourceText.setProperty(String.format("%s.%s",elementName,DESCRIPTION_TAGLET_NAME),formatText(description));
  20. }

代码示例来源:origin: uk.org.retep.doclet/core

  1. DocFinder.search(new DocFinder.Input((MethodDoc) member));
  2. if (inheritedDoc.holder != null &&
  3. inheritedDoc.holder.firstSentenceTags().length > 0) {
  4. firstSentenceTags = inheritedDoc.holder.firstSentenceTags();

代码示例来源:origin: konsoletyper/teavm-javac

  1. DocFinder.search(new DocFinder.Input((MethodDoc) member));
  2. if (inheritedDoc.holder != null
  3. && inheritedDoc.holder.firstSentenceTags().length > 0) {
  4. firstSentenceTags = inheritedDoc.holder.firstSentenceTags();

代码示例来源:origin: de.unkrig/de-unkrig-commons

  1. /**
  2. * @return The "description" text for a javadoc-ish summary table; composed from the first sentence of the doc
  3. * comment and its (optional) "{@code @deprecated}" tags
  4. */
  5. public String
  6. summaryDescription(Doc doc, RootDoc rootDoc) {
  7. Tag[] dts = doc.tags("@deprecated");
  8. try {
  9. if (dts.length == 0) {
  10. return this.fromTags(doc.firstSentenceTags(), doc, rootDoc);
  11. } else {
  12. return (
  13. "<div class=\"block\"><strong>Deprecated.</strong><div class=\"block\"><i>"
  14. + this.fromTags(dts[0].inlineTags(), doc, rootDoc)
  15. + "</i></div></div>"
  16. );
  17. }
  18. } catch (Longjump e) {
  19. return "???";
  20. }
  21. }
  22. }

代码示例来源:origin: de.unkrig.commons/commons-doclet

  1. /**
  2. * @return The "description" text for a javadoc-ish summary table; composed from the first sentence of the doc
  3. * comment and its (optional) "{@code @deprecated}" tags
  4. */
  5. public String
  6. summaryDescription(Doc doc, RootDoc rootDoc) {
  7. Tag[] dts = doc.tags("@deprecated");
  8. try {
  9. if (dts.length == 0) {
  10. return this.fromTags(doc.firstSentenceTags(), doc, rootDoc);
  11. } else {
  12. return (
  13. "<div class=\"block\"><strong>Deprecated.</strong><div class=\"block\"><i>"
  14. + this.fromTags(dts[0].inlineTags(), doc, rootDoc)
  15. + "</i></div></div>"
  16. );
  17. }
  18. } catch (Longjump e) {
  19. return "???";
  20. }
  21. }
  22. }

相关文章