javax.lang.model.util.SimpleElementVisitor8 Java Examples

The following examples show how to use javax.lang.model.util.SimpleElementVisitor8. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClassWriterImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@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);
}
 
Example #2
Source File: RetainerLUTModel.java    From Akatsuki with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: MoreElements.java    From doma with Apache License 2.0 5 votes vote down vote up
public TypeElement toTypeElement(Element element) {
  assertNotNull(element);
  return element.accept(
      new SimpleElementVisitor8<TypeElement, Void>() {

        // delegate to elementUtils
        public TypeElement visitType(TypeElement e, Void p) {
          return e;
        }
      },
      null);
}
 
Example #4
Source File: MoreElements.java    From doma with Apache License 2.0 5 votes vote down vote up
public TypeParameterElement toTypeParameterElement(Element element) {
  assertNotNull(element);
  return element.accept(
      new SimpleElementVisitor8<TypeParameterElement, Void>() {

        @Override
        public TypeParameterElement visitTypeParameter(TypeParameterElement e, Void aVoid) {
          return e;
        }
      },
      null);
}
 
Example #5
Source File: MoreElements.java    From doma with Apache License 2.0 5 votes vote down vote up
public ExecutableType toExecutableType(Element element) {
  assertNotNull(element);
  return element.accept(
      new SimpleElementVisitor8<ExecutableType, Void>() {

        public ExecutableType visitExecutableType(ExecutableType e, Void p) {
          return e;
        }
      },
      null);
}