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

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

Introduction

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

Prototype

TypeDeclaration getTypeDeclaration(String name);

Source Link

Document

Returns the declaration of a type given its fully qualified name.

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);
            }/* w w w. ja  va2  s .  co m*/
        }
    }
}