本文整理汇总了Java中com.sun.source.doctree.DocTree类的典型用法代码示例。如果您正苦于以下问题:Java DocTree类的具体用法?Java DocTree怎么用?Java DocTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DocTree类属于com.sun.source.doctree包,在下文中一共展示了DocTree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkReference
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
void checkReference(ReferenceTree tree, List<? extends DocTree> label) {
String sig = tree.getSignature();
Element found = trees.getElement(new DocTreePath(getCurrentPath(), tree));
if (found == null) {
System.err.println(sig + " NOT FOUND");
} else {
System.err.println(sig + " found " + found.getKind() + " " + found);
}
String expect = "UNKNOWN";
if (label.size() > 0 && label.get(0) instanceof TextTree)
expect = ((TextTree) label.get(0)).getBody();
if (!expect.equalsIgnoreCase(found == null ? "bad" : found.getKind().name())) {
error(tree, "Unexpected value found: " + found +", expected: " + expect);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:ReferenceTest.java
示例2: addCommentTags
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
/**
* Adds the comment tags.
*
* @param element for which the comment tags will be generated
* @param holderTag the block tag context for the inline tags
* @param tags the first sentence tags for the doc
* @param depr true if it is deprecated
* @param first true if the first sentence tags should be added
* @param htmltree the documentation tree to which the comment tags will be added
*/
private void addCommentTags(Element element, DocTree holderTag, List<? extends DocTree> tags, boolean depr,
boolean first, Content htmltree) {
if(configuration.nocomment){
return;
}
Content div;
Content result = commentTagsToContent(null, element, tags, first);
if (depr) {
Content italic = HtmlTree.SPAN(HtmlStyle.deprecationComment, result);
div = HtmlTree.DIV(HtmlStyle.block, italic);
htmltree.addContent(div);
}
else {
div = HtmlTree.DIV(HtmlStyle.block, result);
htmltree.addContent(div);
}
if (tags.isEmpty()) {
htmltree.addContent(Contents.SPACE);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:HtmlDocletWriter.java
示例3: run
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
public boolean run(DocletEnvironment root) {
DocTrees trees = root.getDocTrees();
TypeElement cd = ElementFilter.typesIn(root.getIncludedElements()).iterator().next();
DocCommentTree docCommentTree = trees.getDocCommentTree(cd);
List<? extends DocTree> tags = docCommentTree.getBody();
for (int i = 0; i < tags.size(); i++) {
System.out.println(tags.get(0).getKind());
// if (!tags[i].name().equals(expectedTags[i]) ||
// !tags[i].text().equals(expectedText[i])) {
// throw new Error("Tag \"" + tags[i] + "\" not as expected");
// }
}
return true;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:InlineTagsWithBraces.java
示例4: getTagletOutput
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
/**
* Given an array of <code>ParamTag</code>s,return its string representation.
* Try to inherit the param tags that are missing.
*
* @param holder the element that holds the param tags.
* @param writer the TagletWriter that will write this tag.
* @param formalParameters The array of parmeters (from type or executable
* member) to check.
*
* @return the TagletOutput representation of these <code>ParamTag</code>s.
*/
private Content getTagletOutput(boolean isParameters, Element holder,
TagletWriter writer, List<? extends Element> formalParameters, List<? extends DocTree> paramTags) {
Content result = writer.getOutputInstance();
Set<String> alreadyDocumented = new HashSet<>();
if (!paramTags.isEmpty()) {
result.addContent(
processParamTags(holder, isParameters, paramTags,
getRankMap(writer.configuration().utils, formalParameters), writer, alreadyDocumented)
);
}
if (alreadyDocumented.size() != formalParameters.size()) {
//Some parameters are missing corresponding @param tags.
//Try to inherit them.
result.addContent(getInheritedTagletOutput(isParameters, holder,
writer, formalParameters, alreadyDocumented));
}
return result;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:ParamTaglet.java
示例5: iterator
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
@Override
public Iterator<DocTree> iterator() {
return new Iterator<DocTree>() {
@Override
public boolean hasNext() {
return next != null;
}
@Override
public DocTree next() {
DocTree t = next.leaf;
next = next.parent;
return t;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
private DocTreePath next = DocTreePath.this;
};
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:DocTreePath.java
示例6: createAddParamTagFix
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
public static JavaFix createAddParamTagFix(DocTreePathHandle dtph, final String name, final boolean isTypeParam, int index) {
return new AddTagFix(dtph, isTypeParam? MISSING_TYPEPARAM_HINT("<" + name + ">"):MISSING_PARAM_HINT(name), index) {
@Override
protected DocTree getNewTag(TreeMaker make) {
return make.Param(isTypeParam, make.DocIdentifier(name), Collections.EMPTY_LIST);
}
};
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:AddTagFix.java
示例7: rewriteChildren
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
protected final IndexTree rewriteChildren(IndexTree tree) {
IndexTree value = tree;
List<? extends DocTree> desc = translateDoc(tree.getDescription());
DocTree term = translate(tree.getSearchTerm());
if (desc != tree.getDescription() || term != tree.getSearchTerm()) {
value = make.Index(term, desc);
}
return value;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ImmutableDocTreeTranslator.java
示例8: warnIfEmpty
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
void warnIfEmpty(DocTree tree, List<? extends DocTree> list) {
// for (DocTree d: list) {
// switch (d.getKind()) {
// case TEXT:
// if (hasNonWhitespace((TextTree) d))
// return;
// break;
// default:
// return;
// }
// }
// env.messages.warning(SYNTAX, tree, "dc.empty", tree.getKind().tagName);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:Analyzer.java
示例9: performRewrite
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
@Override
protected void performRewrite(TransformationContext ctx) throws Exception {
WorkingCopy javac = ctx.getWorkingCopy();
DocTreePath path = dtph.resolve(javac);
DocCommentTree docComment = path.getDocComment();
TreeMaker make = javac.getTreeMaker();
TagComparator comparator = new TagComparator();
final List<DocTree> blockTags = new LinkedList<DocTree>();
DocTree newTree = getNewTag(make);
boolean added = false;
int count = 0;
for (DocTree docTree : docComment.getBlockTags()) {
if (!added && comparator.compare(newTree, docTree) == TagComparator.HIGHER) {
blockTags.add(newTree);
added = true;
}
if (!added && comparator.compare(newTree, docTree) == TagComparator.EQUAL &&
index == count++) {
blockTags.add(newTree);
added = true;
}
blockTags.add(docTree);
}
if (!added) {
blockTags.add(newTree);
}
DocCommentTree newDoc = make.DocComment(docComment.getFirstSentence(), docComment.getBody(), blockTags);
Tree tree = ctx.getPath().getLeaf();
javac.rewrite(tree, docComment, newDoc);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:AddTagFix.java
示例10: addMemberDescription
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
/**
* Add the description text for this member represented by the tag.
*
* @param serialFieldTag the field to document (represented by tag)
* @param contentTree the tree to which the deprecated info will be added
*/
public void addMemberDescription(VariableElement field, DocTree serialFieldTag, Content contentTree) {
CommentHelper ch = utils.getCommentHelper(field);
List<? extends DocTree> description = ch.getDescription(configuration, serialFieldTag);
if (!description.isEmpty()) {
Content serialFieldContent = new RawHtml(ch.getText(description));
Content div = HtmlTree.DIV(HtmlStyle.block, serialFieldContent);
contentTree.addContent(div);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:HtmlSerialFieldWriter.java
示例11: setEnumValuesTree
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
public void setEnumValuesTree(BaseConfiguration config, Element e) {
Utils utils = config.utils;
String klassName = utils.getSimpleName(utils.getEnclosingTypeElement(e));
List<DocTree> fullBody = new ArrayList<>();
fullBody.add(treeFactory.newTextTree(config.getText("doclet.enum_values_doc.fullbody", klassName)));
List<DocTree> descriptions = new ArrayList<>();
descriptions.add(treeFactory.newTextTree(config.getText("doclet.enum_values_doc.return")));
List<DocTree> tags = new ArrayList<>();
tags.add(treeFactory.newReturnTree(descriptions));
DocCommentTree docTree = treeFactory.newDocCommentTree(fullBody, tags);
dcTreesMap.put(e, new DocCommentDuo(null, docTree));
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:CommentUtils.java
示例12: isSentenceBreak
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
private boolean isSentenceBreak(DocTree dt, boolean isFirstDocTree) {
switch (dt.getKind()) {
case START_ELEMENT:
StartElementTree set = (StartElementTree)dt;
return !isFirstDocTree && ((DCTree) dt).pos > 1 && isSentenceBreak(set.getName());
case END_ELEMENT:
EndElementTree eet = (EndElementTree)dt;
return !isFirstDocTree && ((DCTree) dt).pos > 1 && isSentenceBreak(eet.getName());
default:
return false;
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:DocTreeMaker.java
示例13: visitSee
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
@Override
public Void visitSee(SeeTree tree, Void ignore) {
List<? extends DocTree> refLabel = tree.getReference();
if (refLabel.size() > 1 && (refLabel.get(0) instanceof ReferenceTree)) {
ReferenceTree ref = (ReferenceTree) refLabel.get(0);
List<? extends DocTree> label = refLabel.subList(1, refLabel.size());
checkReference(ref, label);
}
return null;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:ReferenceTest.java
示例14: warnIfEmpty
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
void warnIfEmpty(DocTree tree, List<? extends DocTree> list) {
for (DocTree d: list) {
switch (d.getKind()) {
case TEXT:
if (hasNonWhitespace((TextTree) d))
return;
break;
default:
return;
}
}
env.messages.warning(SYNTAX, tree, "dc.empty", tree.getKind().tagName);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:Checker.java
示例15: visitDocComment
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
@Override
public Void visitDocComment(DocCommentTree tree, Void ignore) {
super.visitDocComment(tree, ignore);
for (TagStackItem tsi: tagStack) {
warnIfEmpty(tsi, null);
if (tsi.tree.getKind() == DocTree.Kind.START_ELEMENT
&& tsi.tag.endKind == HtmlTag.EndKind.REQUIRED) {
StartElementTree t = (StartElementTree) tsi.tree;
env.messages.error(HTML, t, "dc.tag.not.closed", t.getName());
}
}
return null;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:Checker.java
示例16: printMessage
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public void printMessage(Diagnostic.Kind kind, CharSequence msg,
com.sun.source.doctree.DocTree t,
com.sun.source.doctree.DocCommentTree c,
com.sun.source.tree.CompilationUnitTree root) {
printMessage(kind, msg, ((DCTree) t).pos((DCDocComment) c), root);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:JavacTrees.java
示例17: newThrowsTree
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public DCThrows newThrowsTree(ReferenceTree name, List<? extends DocTree> description) {
// TODO: verify the reference is just to a type (not a field or method)
DCThrows tree = new DCThrows(Kind.THROWS, (DCReference) name, cast(description));
tree.pos = pos;
return tree;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:DocTreeMaker.java
示例18: visitDocComment
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitDocComment(DocCommentTree tree, Void ignore) {
super.visitDocComment(tree, ignore);
for (TagStackItem tsi: tagStack) {
warnIfEmpty(tsi, null);
if (tsi.tree.getKind() == DocTree.Kind.START_ELEMENT
&& tsi.tag.endKind == HtmlTag.EndKind.REQUIRED) {
StartElementTree t = (StartElementTree) tsi.tree;
env.messages.error(HTML, t, "dc.tag.not.closed", t.getName());
}
}
return null;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:Checker.java
示例19: visitProvides
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
@Override
public Void visitProvides(ProvidesTree node, Void p) {
printTagName(node);
needSpace();
doAccept((DCTree)node.getServiceType());
if (!node.getDescription().isEmpty()) {
needSpace();
for (DocTree docTree : node.getDescription()) {
doAccept((DCTree)docTree);
}
}
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:VeryPretty.java
示例20: visitSince
import com.sun.source.doctree.DocTree; //导入依赖的package包/类
@Override
public Void visitSince(SinceTree node, Void p) {
printTagName(node);
print(" ");
for (DocTree docTree : node.getBody()) {
doAccept((DCTree)docTree);
}
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:VeryPretty.java
注:本文中的com.sun.source.doctree.DocTree类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论