本文整理匯總了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());
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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()));
}
}
示例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;
}
示例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;
}
}
示例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());
}
示例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;
}
示例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());
}
}
}
示例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;
}