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

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

Introduction

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

Prototype

Collection<TypeDeclaration> getSpecifiedTypeDeclarations();

Source Link

Document

Returns the declarations of the types specified when the annotation processing tool was invoked.

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);
            }/*ww  w .  j  ava  2s .  co  m*/
        }
    }
}