本文整理汇总了Java中javax.lang.model.util.SimpleElementVisitor8类的典型用法代码示例。如果您正苦于以下问题:Java SimpleElementVisitor8类的具体用法?Java SimpleElementVisitor8怎么用?Java SimpleElementVisitor8使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleElementVisitor8类属于javax.lang.model.util包,在下文中一共展示了SimpleElementVisitor8类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addNestedClassInfo
import javax.lang.model.util.SimpleElementVisitor8; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void addNestedClassInfo(final Content classInfoTree) {
Element outerClass = typeElement.getEnclosingElement();
if (outerClass == null)
return;
new SimpleElementVisitor8<Void, Void>() {
@Override
public Void visitType(TypeElement e, Void p) {
Content label = utils.isInterface(e)
? contents.enclosingInterfaceLabel
: contents.enclosingClassLabel;
Content dt = HtmlTree.DT(label);
Content dl = HtmlTree.DL(dt);
Content dd = new HtmlTree(HtmlTag.DD);
dd.addContent(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.CLASS, e)));
dl.addContent(dd);
classInfoTree.addContent(dl);
return null;
}
}.visit(outerClass);
}
示例2: addNestedClassInfo
import javax.lang.model.util.SimpleElementVisitor8; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void addNestedClassInfo(final Content classInfoTree) {
Element outerClass = typeElement.getEnclosingElement();
if (outerClass == null)
return;
new SimpleElementVisitor8<Void, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public Void visitType(TypeElement e, Void p) {
String label = utils.isInterface(e)
? "doclet.Enclosing_Interface"
: "doclet.Enclosing_Class";
Content dt = HtmlTree.DT(getResource(label));
Content dl = HtmlTree.DL(dt);
Content dd = new HtmlTree(HtmlTag.DD);
dd.addContent(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.CLASS, e)));
dl.addContent(dd);
classInfoTree.addContent(dl);
return null;
}
}.visit(outerClass);
}
示例3: findAllTypes
import javax.lang.model.util.SimpleElementVisitor8; //导入依赖的package包/类
private Map<String, RetainedStateModel> findAllTypes(final Element element,
final Map<String, RetainedStateModel> referenceMap) {
Map<String, RetainedStateModel> modelMap = new HashMap<>();
element.accept(new SimpleElementVisitor8<Void, Map<String, RetainedStateModel>>() {
@Override
public Void visitType(TypeElement e, Map<String, RetainedStateModel> map) {
if (e.getKind() == ElementKind.CLASS) {
// only process class that isn't in the map
if (!referenceMap.containsKey(e.getQualifiedName().toString())) {
findInheritedModel(e, referenceMap.values())
.ifPresent(m -> map.put(e.getQualifiedName().toString(), m));
}
e.getEnclosedElements().forEach(ee -> ee.accept(this, map));
}
return null;
}
}, modelMap);
return modelMap;
}
示例4: toTypeElement
import javax.lang.model.util.SimpleElementVisitor8; //导入依赖的package包/类
public static TypeElement toTypeElement(TypeMirror typeMirror,
final ProcessingEnvironment env) {
assertNotNull(typeMirror, env);
Element element = env.getTypeUtils().asElement(typeMirror);
if (element == null) {
return null;
}
return element.accept(new SimpleElementVisitor8<TypeElement, Void>() {
@Override
public TypeElement visitType(TypeElement e, Void p) {
return e;
}
}, null);
}
示例5: toTypeElement
import javax.lang.model.util.SimpleElementVisitor8; //导入依赖的package包/类
public static TypeElement toTypeElement(Element element,
ProcessingEnvironment env) {
assertNotNull(element, env);
return element.accept(new SimpleElementVisitor8<TypeElement, Void>() {
@Override
public TypeElement visitType(TypeElement e, Void p) {
return e;
}
}, null);
}