Example usage for org.eclipse.jdt.apt.core.env EclipseAnnotationProcessorEnvironment getDeclarationsAnnotatedWith

List of usage examples for org.eclipse.jdt.apt.core.env EclipseAnnotationProcessorEnvironment getDeclarationsAnnotatedWith

Introduction

In this page you can find the example usage for org.eclipse.jdt.apt.core.env EclipseAnnotationProcessorEnvironment getDeclarationsAnnotatedWith.

Prototype

Collection<Declaration> getDeclarationsAnnotatedWith(AnnotationTypeDeclaration a);

Source Link

Document

Returns the declarations annotated with the given annotation type.

Usage

From source file:org.eclipselabs.stlipse.apt.StlipseAnnotationProcessor.java

License:Open Source License

public void process() {
    if (environment instanceof EclipseAnnotationProcessorEnvironment) {
        EclipseAnnotationProcessorEnvironment env = (EclipseAnnotationProcessorEnvironment) environment;
        IJavaProject javaProject = env.getJavaProject();
        String actionBeanType = env.getSpecifiedTypeDeclarations().iterator().next().getQualifiedName();
        for (String annotationType : StlipseAnnotationProcessorFactory.SUPPORTED_ANNOTATIONS) {
            AnnotationTypeDeclaration annotation = (AnnotationTypeDeclaration) env
                    .getTypeDeclaration(annotationType);
            Collection<Declaration> annotatedProperties = env.getDeclarationsAnnotatedWith(annotation);
            for (Declaration annotatedProperty : annotatedProperties) {
                StlipseAnnotationVisitor visitor = new StlipseAnnotationVisitor(annotationType, javaProject,
                        actionBeanType, env.getMessager());
                annotatedProperty.accept(visitor);
            }/*from  ww  w .  j  a v  a2 s .c  o m*/
        }
    }
}