javax.lang.model.element.ElementVisitor Java Examples

The following examples show how to use javax.lang.model.element.ElementVisitor. 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: PluginProcessor.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
private String collectPlugins(String packageName, final Iterable<? extends Element> elements, List<PluginEntry> list) {
    boolean calculatePackage = packageName == null;
    final Elements elementUtils = processingEnv.getElementUtils();
    final ElementVisitor<PluginEntry, Plugin> pluginVisitor = new PluginElementVisitor(elementUtils);
    final ElementVisitor<Collection<PluginEntry>, Plugin> pluginAliasesVisitor = new PluginAliasesElementVisitor(
            elementUtils);
    for (final Element element : elements) {
        final Plugin plugin = element.getAnnotation(Plugin.class);
        if (plugin == null) {
            continue;
        }
        final PluginEntry entry = element.accept(pluginVisitor, plugin);
        list.add(entry);
        if (calculatePackage) {
            packageName = calculatePackage(elementUtils, element, packageName);
        }
        final Collection<PluginEntry> entries = element.accept(pluginAliasesVisitor, plugin);
        for (final PluginEntry pluginEntry : entries) {
            list.add(pluginEntry);
        }
    }
    return packageName;
}
 
Example #2
Source File: LayerBuilderTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testOriginatingElementComments() throws Exception {
    b = new LayerBuilder(doc, new Element() {
        public @Override ElementKind getKind() {
            return ElementKind.OTHER;
        }
        public @Override String toString() {
            return "originating.Type";
        }
        public @Override TypeMirror asType() {return null;}
        public @Override List<? extends AnnotationMirror> getAnnotationMirrors() {return null;}
        public @Override <A extends Annotation> A getAnnotation(Class<A> annotationType) {return null;}
        public @Override Set<Modifier> getModifiers() {return null;}
        public @Override Name getSimpleName() {return null;}
        public @Override Element getEnclosingElement() {return null;}
        public @Override List<? extends Element> getEnclosedElements() {return null;}
        public @Override <R, P> R accept(ElementVisitor<R, P> v, P p) {return null;}
        @Override
        public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
            return (A[]) Array.newInstance(annotationType, 0);
        }
    }, null);
    b.folder("f").write();
    assertEquals("<filesystem><folder name='f'><!--originating.Type--></folder></filesystem>", dump());
    // #180154: do not repeat after an incremental build
    b.folder("f").write();
    assertEquals("<filesystem><folder name='f'><!--originating.Type--></folder></filesystem>", dump());
}
 
Example #3
Source File: PackageElementImpl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p)
{
	return v.visitPackage(this, p);
}
 
Example #4
Source File: ExecutableElementImpl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p)
{
	return v.visitExecutable(this, p);
}
 
Example #5
Source File: GeneratedTypeElement.java    From j2objc with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitType(this, p);
}
 
Example #6
Source File: GeneratedVariableElement.java    From j2objc with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitVariable(this, p);
}
 
Example #7
Source File: GeneratedPackageElement.java    From j2objc with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitPackage(this, p);
}
 
Example #8
Source File: TreeBackedTypeElement.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitType(this, p);
}
 
Example #9
Source File: InferredTypeElement.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitType(this, p);
}
 
Example #10
Source File: TreeBackedPackageElement.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitPackage(this, p);
}
 
Example #11
Source File: InferredPackageElement.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitPackage(this, p);
}
 
Example #12
Source File: TreeBackedVariableElement.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitVariable(this, p);
}
 
Example #13
Source File: TreeBackedExecutableElement.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitExecutable(this, p);
}
 
Example #14
Source File: CachingElements.java    From immutables with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return delegate.accept(v, p);
}
 
Example #15
Source File: TreeBackedTypeParameterElement.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitTypeParameter(this, p);
}
 
Example #16
Source File: VariableElementImpl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p)
{
	return v.visitVariable(this, p);
}
 
Example #17
Source File: TurbineElement.java    From turbine with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitTypeParameter(this, p);
}
 
Example #18
Source File: TurbineElement.java    From turbine with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitExecutable(this, p);
}
 
Example #19
Source File: TypeParameterElementImpl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p)
{
	return v.visitTypeParameter(this, p);
}
 
Example #20
Source File: GenericElement.java    From FreeBuilder with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitType(this, p);
}
 
Example #21
Source File: GenericElementParameter.java    From FreeBuilder with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitTypeParameter(this, p);
}
 
Example #22
Source File: ClassTypeImpl.java    From FreeBuilder with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitType(this, p);
}
 
Example #23
Source File: PackageElementImpl.java    From FreeBuilder with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitPackage(this, p);
}
 
Example #24
Source File: TypeParameterElementImpl.java    From FreeBuilder with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitTypeParameter(this, p);
}
 
Example #25
Source File: GenericTypeElementImpl.java    From FreeBuilder with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitType(this, p);
}
 
Example #26
Source File: Resolve.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
    throw new AssertionError();
}
 
Example #27
Source File: TurbineElement.java    From turbine with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> elementVisitor, P p) {
  return elementVisitor.visitType(this, p);
}
 
Example #28
Source File: TurbineElement.java    From turbine with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitVariable(this, p);
}
 
Example #29
Source File: TurbineElement.java    From turbine with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitPackage(this, p);
}
 
Example #30
Source File: TurbineElement.java    From turbine with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
  return v.visitVariable(this, p);
}