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

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

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

Doc.commentText介绍

[英]Return the text of the comment for this doc item. Tags have been removed.
[中]返回此文档项的注释文本。标签已被删除。

代码示例

代码示例来源: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: com.gitee.l0km/swift-service-parser

  1. /**
  2. * 输出格式化的注释信息
  3. *
  4. * @param doc
  5. * {@link com.sun.tools.javadoc.ClassDocImpl} 或 {@link com.sun.tools.javadoc.MethodDocImpl}实例
  6. * @param needIndent
  7. * 是否缩进
  8. * @return
  9. */
  10. public final String formatComment(Doc doc, boolean needIndent) {
  11. Preconditions.checkNotNull(doc, "doc is null");
  12. Type type = typeOfDoc(doc);
  13. StringBuffer buffer = new StringBuffer();
  14. commentText(buffer,doc.commentText(),type);
  15. for (Tag tag : doc.tags()) {
  16. if( ! type.check(excludeTags.get(tag.name())) )
  17. buffer.append(tag.name()).append(" ").append(tag.text()).append('\n');
  18. }
  19. String cmt = buffer.toString();
  20. if (!cmt.isEmpty()) {
  21. cmt = Pattern.compile("\n\\s*", Pattern.MULTILINE).matcher(cmt).replaceAll("\n");
  22. cmt = Pattern.compile("^", Pattern.MULTILINE).matcher(cmt).replaceAll(" * ");
  23. cmt = commentBody.replaceFirst("\n", "$0" + cmt);
  24. if (needIndent)
  25. cmt = Pattern.compile("^", Pattern.MULTILINE).matcher(cmt).replaceAll(indent);
  26. }
  27. return cmt;
  28. }

代码示例来源:origin: io.atlassian.json-schemagen/json-schemagen-scanner

  1. private static String getDocWithIncludes(Doc doc)
  2. {
  3. StringBuilder sb = new StringBuilder();
  4. if (!Strings.isNullOrEmpty(doc.commentText()))
  5. {
  6. for (Tag tag : doc.inlineTags())
  7. {
  8. if (tag.kind().equals(TEXT_TAG))
  9. {
  10. sb.append(P).append(tag.text());
  11. }
  12. else if (tag.kind().equals(SEE_TAG))
  13. {
  14. sb.append(getIncludeFromLink((SeeTag) tag));
  15. }
  16. }
  17. //sb.append(doc.commentText()).append(LS).append(LS);
  18. }
  19. String example = getExamples(doc);
  20. if (!Strings.isNullOrEmpty(example))
  21. {
  22. sb.append(example);
  23. }
  24. return sb.toString();
  25. }

代码示例来源:origin: org.asciidoctor/asciidoclet

  1. /**
  2. * Renders a generic document (class, field, method, etc)
  3. *
  4. * @param doc input
  5. */
  6. @Override
  7. public void renderDoc(Doc doc) {
  8. // hide text that looks like tags (such as annotations in source code) from Javadoc
  9. doc.setRawCommentText(doc.getRawCommentText().replaceAll("@([A-Z])", "{@literal @}$1"));
  10. StringBuilder buffer = new StringBuilder();
  11. buffer.append(render(doc.commentText(), false));
  12. buffer.append('\n');
  13. for (Tag tag : doc.tags()) {
  14. renderTag(tag, buffer);
  15. buffer.append('\n');
  16. }
  17. doc.setRawCommentText(buffer.toString());
  18. }

代码示例来源:origin: ch.raffael.pegdown-doclet/pegdown-doclet

  1. try {
  2. StringBuilder buf = new StringBuilder();
  3. buf.append(getOptions().toHtml(doc.commentText(), fixLeadingSpaces));
  4. buf.append('\n');
  5. for ( Tag tag : doc.tags() ) {

相关文章