/** * {@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); }
/** * {@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); }
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; }
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); }
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); }