當前位置: 首頁>>代碼示例>>Java>>正文


Java Doc.tags方法代碼示例

本文整理匯總了Java中com.sun.javadoc.Doc.tags方法的典型用法代碼示例。如果您正苦於以下問題:Java Doc.tags方法的具體用法?Java Doc.tags怎麽用?Java Doc.tags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sun.javadoc.Doc的用法示例。


在下文中一共展示了Doc.tags方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTagletOutput

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 * @see com.sun.tools.doclets.internal.toolkit.taglets.Taglet#getTagletOutput(com.sun.javadoc.Doc, com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter)
 */
@Override
public TagletOutput getTagletOutput(Doc doc, TagletWriter writer) throws IllegalArgumentException {
	Tag[] tags = doc.tags(getName());
	if (tags.length==0 && doc instanceof MethodDoc) { // inherit if necessary and possible
		final DocFinder.Output inheritedDoc = DocFinder.search(new DocFinder.Input((MethodDoc) doc, this));
		tags = inheritedDoc.holderTag == null ? tags : new Tag[] {inheritedDoc.holderTag};
	}
	if (tags.length==0)
		return null;
	final StringBuilder out = writeHeader(new StringBuilder());
	for(Tag tag : tags) { 
		writeTag(out, tag, writer);
	}
	return new TagletOutputImpl(out.toString());
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:20,代碼來源:SpecificationTaglet.java

示例2: getTagletOutput

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public Content getTagletOutput(Doc doc, TagletWriter writer) throws IllegalArgumentException {
	Tag[] tags = doc.tags(getName());
	if (tags.length==0 && doc instanceof MethodDoc) { // inherit if necessary and possible
		final DocFinder.Output inheritedDoc = DocFinder.search(new DocFinder.Input((MethodDoc) doc, this));
		tags = inheritedDoc.holderTag == null ? tags : new Tag[] {inheritedDoc.holderTag};
	}
	if (tags.length==0)
		return null;
	final StringBuilder out = writeHeader(new StringBuilder());
	for(Tag tag : tags) { 
		writeTag(out, tag, writer);
	}
	return new RawHtml(out.toString());
}
 
開發者ID:emina,項目名稱:kodkod,代碼行數:19,代碼來源:SpecificationTaglet.java

示例3: toStandardTags

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
/**
 * Transforms common tags on the Doc object into XML.
 *
 * @param doc The Doc object.
 * @return The corresponding list of nodes.
 */
private static List<XMLNode> toStandardTags(Doc doc) {
  // Create the comment node
  List<XMLNode> nodes = new ArrayList<XMLNode>();

  // Handle the tags
  for (Tag tag : doc.tags()) {
    Taglet taglet = options.getTagletForName(tag.name().length() > 1? tag.name().substring(1) : "");
    if (taglet instanceof BlockTag) {
      nodes.add(((BlockTag) taglet).toXMLNode(tag));
    }
  }

  // Add the node to the host
  return nodes;
}
 
開發者ID:pageseeder,項目名稱:xmldoclet,代碼行數:22,代碼來源:XMLDoclet.java

示例4: toTags

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
/**
 * Transforms comments on the Doc object into XML.
 *
 * @param doc The Doc object.
 * @param node The node to add the comment nodes to.
 */
private static XMLNode toTags(Doc doc) {
  // Create the comment node
  XMLNode node = new XMLNode("tags");

  boolean hasTags = false;

  // Handle the tags
  for (Tag tag : doc.tags()) {
    Taglet taglet = options.getTagletForName(tag.name().length() > 1? tag.name().substring(1) : "");
    if (taglet != null && !(taglet instanceof BlockTag)) {
      XMLNode tNode = new XMLNode("tag");
      tNode.attribute("name", tag.name());
      tNode.text(taglet.toString(tag));
      node.child(tNode);
      hasTags = true;
    }
  }

  // Add the node to the host
  return hasTags? node : null;
}
 
開發者ID:pageseeder,項目名稱:xmldoclet,代碼行數:28,代碼來源:XMLDoclet.java

示例5: exclude

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
private static boolean exclude(Doc doc) {
    // if (doc.name().contains("UnitTest")) {
    // return true;
    // }
    if (doc != null) {
        if (doc.tags(EXCLUDE_TAG).length > 0) {
            return true;
        } else if (doc instanceof ProgramElementDoc) {
            if (exclude(((ProgramElementDoc) doc).containingPackage())) {
                return true;
            } else if (exclude(((ProgramElementDoc) doc).containingClass())) {
                return true;
            }
        }
    }
    // nothing above found a reason to exclude
    return false;
}
 
開發者ID:SUPENTA,項目名稱:flitchio-sdk,代碼行數:19,代碼來源:JavadocFilter.java

示例6: formatDeprecatedTags

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
private String formatDeprecatedTags(Doc doc)
{
  Tag[] deprecatedTags = doc.tags("deprecated");
  if(deprecatedTags.length > 0)
  {
    StringBuilder deprecatedText = new StringBuilder();
    for(int i = 0; i < deprecatedTags.length; i++)
    {
      deprecatedText.append(deprecatedTags[i].text());
      if(i < deprecatedTags.length - 1)
      {
        deprecatedText.append(" ");
      }
    }
    return deprecatedText.toString();
  }
  else
  {
    return null;
  }
}
 
開發者ID:ppdai,項目名稱:rest4j,代碼行數:22,代碼來源:DocletDocsProvider.java

示例7: hasMoreInfos

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
/**
 * Compares full desc. to short desc. to see wether more infos avail.
 * @return
 */
public boolean hasMoreInfos(Doc doc)
{
    //System.out.println(doc.name());
    String s1, s2;
    try
    {
        s1 = docWriter.commentTagsToString(null, doc, doc.inlineTags(), false);
        s2 = docWriter.commentTagsToString(null, doc, doc.firstSentenceTags(), true);
    } catch (ClassCastException e)
    {
        // java/lang/StringBuilder.html codePointAt javadic causes this -> why ??
        System.err.println("Error parsing comments for " + doc.name());
        return false;
    }
    return s1.length() > s2.length() ||
            doc.tags("return").length > 0 ||
            doc.tags("param").length > 0 ||
            doc.tags("see").length > 0 ||
            doc.tags("since").length > 0 ||
            doc.tags("throws").length > 0 ||
            doc.tags("exception").length > 0;
}
 
開發者ID:tcolar,項目名稱:javaontracks,代碼行數:27,代碼來源:JOTDocletNavView.java

示例8: getSeeTags

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
public Vector getSeeTags()
{
    // adjust the path, so the links get build correctly
    docWriter.relativePath = getPathToRoot();
    Doc pack = (Doc) getVariables().get("curitem");
    Tag[] tags = pack.tags("see");
    Vector results = new Vector();
    for (int i = 0; i != tags.length; i++)
    {
        SeeTag tag = (SeeTag) tags[i];

        String link = docWriter.seeTagToString(tag);

        results.add(link);
    }
    return results;
}
 
開發者ID:tcolar,項目名稱:javaontracks,代碼行數:18,代碼來源:JOTDocletNavView.java

示例9: addSummaryAndRemarksCommentInfo

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
/**
 * Convert the javadoc comments into an array of my CommentInfo objects.
 * @param doc
 * @param cinfos
 */
private void addSummaryAndRemarksCommentInfo(Doc doc, ArrayList<CommentInfo> cinfos) {
	String summaryText = concatTags(doc.firstSentenceTags());
	String totalText = concatTags(doc.inlineTags());
	String remarksText = "";
	if (totalText.length() > summaryText.length()) {
		remarksText = totalText.substring(summaryText.length()).trim();
	}
	if (summaryText.length() != 0) {
		cinfos.add(makeCommentInfo(CommentInfo.KIND_SUMMARY, summaryText));
	}
	if (remarksText.length() != 0) {
		cinfos.add(makeCommentInfo(CommentInfo.KIND_REMARKS, remarksText));
	}
	for (Tag tag : doc.tags()) {
		cinfos.add(makeCommentInfo(tag.kind(), tag.text()));
	}
}
 
開發者ID:wolfgangimig,項目名稱:byps,代碼行數:23,代碼來源:BConvert.java

示例10: isResource

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
private static boolean isResource(Doc doc) {
    for (Tag t : doc.tags()) {
        if (t.kind().equals("@h2.resource")) {
            return true;
        }
    }
    return false;
}
 
開發者ID:vdr007,項目名稱:ThriftyPaxos,代碼行數:9,代碼來源:ResourceDoclet.java

示例11: getTag

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
private static Tag[] getTag(Doc doc, String name, boolean check) {
	
	Tag[] tags = doc.tags(name);
	
	if (check && tags.length <= 0) {
		throw new IllegalStateException("api doc:Tag[@"+name+"] must requied in position: " + doc.position());
	} 
	
	if (tags.length <= 0) {
		return null;
	} else {
		return tags;
	}
}
 
開發者ID:linkeer8802,項目名稱:api-resolver,代碼行數:15,代碼來源:ApiDoclet.java

示例12: renderDoc

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
/**
 * Renders a generic document (class, field, method, etc)
 *
 * @param doc input
 */
@Override
public void renderDoc(Doc doc) {
    // hide text that looks like tags (such as annotations in source code) from Javadoc
    doc.setRawCommentText(doc.getRawCommentText().replaceAll("@([A-Z])", "{@literal @}$1"));

    StringBuilder buffer = new StringBuilder();
    buffer.append(render(doc.commentText(), false));
    buffer.append('\n');
    for (Tag tag : doc.tags()) {
        renderTag(tag, buffer);
        buffer.append('\n');
    }
    doc.setRawCommentText(buffer.toString());
}
 
開發者ID:asciidoctor,項目名稱:asciidoclet,代碼行數:20,代碼來源:AsciidoctorRenderer.java

示例13: toDeprecated

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
/**
 * Transforms deprecated tags on the Doc object into XML.
 *
 * @param doc The Doc object.
 * @param node The node to add the deprecated nodes to.
 */
private static XMLNode toDeprecated(Doc doc, XMLNode node) {
    Tag[] deprecatedTags = doc.tags("@deprecated");

    if (deprecatedTags.length > 0) {
      StringBuilder shortText = new StringBuilder();

      // Analyse each token and produce text node
      for (Tag t : deprecatedTags[0].firstSentenceTags()) {
        Taglet taglet = options.getTagletForName(t.name());
        if (taglet != null) shortText.append(taglet.toString(t));
        else shortText.append(t.text());
      }

      if (shortText.length() == 0) {
        shortText.append("Deprecated.");
      }

      String fullText = toComment(deprecatedTags[0]);
      fullText = fullText != null ? fullText.substring(shortText.length()).trim() : "";

      XMLNode shortNode = new XMLNode("shortDeprecated", doc, doc.position().line());
      XMLNode fullNode = new XMLNode("deprecated", doc, doc.position().line());

      if (shortText.toString().length() > 0) {
        shortNode.text(shortText.toString());
        node.child(shortNode);
      }

      if (fullText.length() > 0) {
        fullNode.text(fullText);
        node.child(fullNode);
      }
    }

    return null;
}
 
開發者ID:bazooka,項目名稱:bazooka-wo-xmldoclet,代碼行數:43,代碼來源:XMLDoclet.java

示例14: defaultProcess

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
/**
 * Default processing of any documentation node.
 *
 * @param doc              The documentation.
 * @param fixLeadingSpaces `true` if leading spaces should be fixed.
 *
 * @see Options#toHtml(String, boolean)
 */
protected void defaultProcess(Doc doc, boolean fixLeadingSpaces) {
    try {
        StringBuilder buf = new StringBuilder();
        buf.append(getOptions().toHtml(doc.commentText(), fixLeadingSpaces));
        buf.append('\n');
        for ( Tag tag : doc.tags() ) {
            processTag(tag, buf);
            buf.append('\n');
        }
        doc.setRawCommentText(buf.toString());
    }
    catch ( final ParserRuntimeException e ) {
        if ( doc instanceof RootDoc ) {
            printError(new SourcePosition() {
                @Override
                public File file() {
                    return options.getOverviewFile();
                }
                @Override
                public int line() {
                    return 0;
                }
                @Override
                public int column() {
                    return 0;
                }
            }, e.getMessage());
        }
        else {
            printError(doc.position(), e.getMessage());
        }
    }
}
 
開發者ID:Abnaxos,項目名稱:markdown-doclet,代碼行數:42,代碼來源:MarkdownDoclet.java

示例15: computeSpecVersion

import com.sun.javadoc.Doc; //導入方法依賴的package包/類
static SpecificationVersion computeSpecVersion(CompilationInfo info, Element el) {
    if (!Utilities.isJavadocSupported(info)) return null;

    Doc javaDoc = info.getElementUtilities().javaDocFor(el);

    if (javaDoc == null) return null;

    for (Tag since : javaDoc.tags("@since")) {
        String text = since.text();

        Matcher m = SPEC_VERSION.matcher(text);

        if (!m.find()) {
            continue;
        }

        return new SpecificationVersion(m.group()/*ver.toString()*/);
    }

    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:JavaFixUtilities.java


注:本文中的com.sun.javadoc.Doc.tags方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。