本文整理汇总了Java中com.sun.source.doctree.DocTree.Kind类的典型用法代码示例。如果您正苦于以下问题:Java Kind类的具体用法?Java Kind怎么用?Java Kind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Kind类属于com.sun.source.doctree.DocTree包,在下文中一共展示了Kind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insideTag
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
private void insideTag(DocTreePath tag, JavadocContext jdctx) {
switch (tag.getLeaf().getKind()) {
case IDENTIFIER:
if (tag.getParentPath() == null || tag.getParentPath().getLeaf().getKind() != Kind.PARAM)
break;
tag = tag.getParentPath();
//intentional fall-through:
case PARAM:
insideParamTag(tag, jdctx);
break;
case SEE: case THROWS: case VALUE:
case LINK: case LINK_PLAIN://XXX: was only unclosed???
insideSeeTag(tag, jdctx);
break;
case REFERENCE:
insideReference(tag, jdctx);
break;
}
}
示例2: getDocLink
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element,
Content label, boolean strong, boolean isProperty) {
if (! (utils.isIncluded(element) || utils.isLinkable(typeElement))) {
return label;
} else if (utils.isExecutableElement(element)) {
ExecutableElement ee = (ExecutableElement)element;
return getLink(new LinkInfoImpl(configuration, context, typeElement)
.label(label)
.where(getName(getAnchor(ee, isProperty)))
.strong(strong));
} else if (utils.isVariableElement(element) || utils.isTypeElement(element)) {
return getLink(new LinkInfoImpl(configuration, context, typeElement)
.label(label)
.where(getName(element.getSimpleName().toString()))
.strong(strong));
} else {
return label;
}
}
示例3: ignoreNonInlineTag
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
boolean ignoreNonInlineTag(DocTree dtree) {
Name name = null;
if (dtree.getKind() == Kind.START_ELEMENT) {
StartElementTree setree = (StartElementTree)dtree;
name = setree.getName();
} else if (dtree.getKind() == Kind.END_ELEMENT) {
EndElementTree eetree = (EndElementTree)dtree;
name = eetree.getName();
}
if (name != null) {
com.sun.tools.doclint.HtmlTag htmlTag = com.sun.tools.doclint.HtmlTag.get(name);
if (htmlTag != null &&
htmlTag.blockType != com.sun.tools.doclint.HtmlTag.BlockType.INLINE) {
return true;
}
}
return false;
}
示例4: getInstance
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
/**
* Construct a new MemberSummaryBuilder for an annotation type.
*
* @param annotationTypeWriter the writer for the class whose members are
* being summarized.
* @param context the build context.
* @return the instance
*/
public static MemberSummaryBuilder getInstance(
AnnotationTypeWriter annotationTypeWriter, Context context) {
MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
annotationTypeWriter.getAnnotationTypeElement()) {
@Override
public void build(Content contentTree) {
buildAnnotationTypeFieldsSummary(contentTree);
buildAnnotationTypeRequiredMemberSummary(contentTree);
buildAnnotationTypeOptionalMemberSummary(contentTree);
}
@Override
public boolean hasMembersToDocument() {
return !utils.getAnnotationMembers(typeElement).isEmpty();
}
};
WriterFactory wf = context.configuration.getWriterFactory();
for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
MemberSummaryWriter msw = builder.getVisibleMemberMap(kind).noVisibleMembers()
? null
: wf.getMemberSummaryWriter(annotationTypeWriter, kind);
builder.memberSummaryWriters.put(kind, msw);
}
return builder;
}
示例5: containsParam
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
private boolean containsParam(List<? extends DocTree> blockTags, String name) {
for (DocTree blockTag : blockTags) {
if(blockTag.getKind() == Kind.PARAM) {
ParamTree param = (ParamTree) blockTag;
if(name.contentEquals(param.getName().getName())) {
return true;
}
}
}
return false;
}
示例6: newExceptionTree
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public DCThrows newExceptionTree(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.EXCEPTION, (DCReference) name, cast(description));
tree.pos = pos;
return tree;
}
示例7: newThrowsTree
import com.sun.source.doctree.DocTree.Kind; //导入依赖的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;
}
示例8: addClassesSummary
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
public void addClassesSummary(SortedSet<TypeElement> classes, String label,
String tableSummary, List<String> tableHeader, Content summaryContentTree) {
if (!classes.isEmpty()) {
Content caption = getTableCaption(new RawHtml(label));
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.typeSummary, caption)
: HtmlTree.TABLE(HtmlStyle.typeSummary, tableSummary, caption);
table.addContent(getSummaryTableHeader(tableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
boolean altColor = true;
for (TypeElement te : classes) {
if (!utils.isCoreClass(te) ||
!configuration.isGeneratedDoc(te)) {
continue;
}
Content classContent = getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.Kind.PACKAGE, te));
Content tdClass = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, classContent);
HtmlTree tr = HtmlTree.TR(tdClass);
tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
altColor = !altColor;
HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
tdClassDescription.addStyle(HtmlStyle.colLast);
if (utils.isDeprecated(te)) {
tdClassDescription.addContent(getDeprecatedPhrase(te));
List<? extends DocTree> tags = utils.getDeprecatedTrees(te);
if (!tags.isEmpty()) {
addSummaryDeprecatedComment(te, tags.get(0), tdClassDescription);
}
} else {
addSummaryComment(te, tdClassDescription);
}
tr.addContent(tdClassDescription);
tbody.addContent(tr);
}
table.addContent(tbody);
summaryContentTree.addContent(table);
}
}
示例9: getPreQualifiedClassLink
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
/**
* Retrieve the class link with the package portion of the label in
* plain text. If the qualifier is excluded, it will not be included in the
* link label.
*
* @param typeElement the class to link to.
* @param isStrong true if the link should be strong.
* @return the link with the package portion of the label in plain text.
*/
public Content getPreQualifiedClassLink(LinkInfoImpl.Kind context,
TypeElement typeElement, boolean isStrong) {
ContentBuilder classlink = new ContentBuilder();
PackageElement pkg = utils.containingPackage(typeElement);
if (pkg != null && ! configuration.shouldExcludeQualifier(pkg.getSimpleName().toString())) {
classlink.addContent(getEnclosingPackageName(typeElement));
}
classlink.addContent(getLink(new LinkInfoImpl(configuration,
context, typeElement).label(utils.getSimpleName(typeElement)).strong(isStrong)));
return classlink;
}
示例10: addPreQualifiedClassLink
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
/**
* Add the class link with the package portion of the label in
* plain text. If the qualifier is excluded, it will not be included in the
* link label.
*
* @param context the id of the context where the link will be added
* @param typeElement the class to link to
* @param isStrong true if the link should be strong
* @param contentTree the content tree to which the link with be added
*/
public void addPreQualifiedClassLink(LinkInfoImpl.Kind context,
TypeElement typeElement, boolean isStrong, Content contentTree) {
PackageElement pkg = utils.containingPackage(typeElement);
if(pkg != null && ! configuration.shouldExcludeQualifier(pkg.getSimpleName().toString())) {
contentTree.addContent(getEnclosingPackageName(typeElement));
}
LinkInfoImpl linkinfo = new LinkInfoImpl(configuration, context, typeElement)
.label(utils.getSimpleName(typeElement))
.strong(isStrong);
Content link = getLink(linkinfo);
contentTree.addContent(link);
}
示例11: isHidden
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
/**
* Returns true if the element is included, contains @hidden tag,
* or if javafx flag is present and element contains @treatAsPrivate
* tag.
* @param e the queried element
* @return true if it exists, false otherwise
*/
public boolean isHidden(Element e) {
// prevent needless tests on elements which are not included
if (!isIncluded(e)) {
return false;
}
if (configuration.javafx &&
hasBlockTag(e, DocTree.Kind.UNKNOWN_BLOCK_TAG, "treatAsPrivate")) {
return true;
}
return hasBlockTag(e, DocTree.Kind.HIDDEN);
}
示例12: shouldDocument
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
private boolean shouldDocument(Element e) {
if (shouldDocumentVisitor == null) {
shouldDocumentVisitor = new SimpleElementVisitor9<Boolean, Void>() {
private boolean hasSource(TypeElement e) {
return configuration.docEnv.getFileKind(e) ==
javax.tools.JavaFileObject.Kind.SOURCE;
}
// handle types
@Override
public Boolean visitType(TypeElement e, Void p) {
return configuration.docEnv.isSelected(e) && hasSource(e);
}
// handle everything else
@Override
protected Boolean defaultAction(Element e, Void p) {
return configuration.docEnv.isSelected(e);
}
@Override
public Boolean visitUnknown(Element e, Void p) {
throw new AssertionError("unkown element: " + p);
}
};
}
return shouldDocumentVisitor.visit(e);
}
示例13: filteredList
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
public List<? extends DocTree> filteredList(List<? extends DocTree> dlist, DocTree.Kind... select) {
List<DocTree> list = new ArrayList<>(dlist.size());
if (select == null)
return dlist;
for (DocTree dt : dlist) {
if (dt.getKind() != ERRONEOUS) {
for (DocTree.Kind kind : select) {
if (dt.getKind() == kind) {
list.add(dt);
}
}
}
}
return list;
}
示例14: getBlockTags0
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
private List<? extends DocTree> getBlockTags0(Element element, DocTree.Kind... kinds) {
DocCommentTree dcTree = getDocCommentTree(element);
if (dcTree == null)
return Collections.emptyList();
return filteredList(dcTree.getBlockTags(), kinds);
}
示例15: getBlockTags
import com.sun.source.doctree.DocTree.Kind; //导入依赖的package包/类
public List<? extends DocTree> getBlockTags(Element element, String tagName) {
DocTree.Kind kind = null;
switch (tagName) {
case "author":
case "deprecated":
case "hidden":
case "param":
case "return":
case "see":
case "serial":
case "since":
case "throws":
case "exception":
case "version":
kind = DocTree.Kind.valueOf(tagName.toUpperCase());
return getBlockTags(element, kind);
case "serialData":
kind = SERIAL_DATA;
return getBlockTags(element, kind);
case "serialField":
kind = SERIAL_FIELD;
return getBlockTags(element, kind);
default:
kind = DocTree.Kind.UNKNOWN_BLOCK_TAG;
break;
}
List<? extends DocTree> blockTags = getBlockTags(element, kind);
List<DocTree> out = new ArrayList<>();
String tname = tagName.startsWith("@") ? tagName.substring(1) : tagName;
CommentHelper ch = getCommentHelper(element);
for (DocTree dt : blockTags) {
if (ch.getTagName(dt).equals(tname)) {
out.add(dt);
}
}
return out;
}