Search in sources :

Example 1 with AnnotatedClassInjector

use of grails.compiler.ast.AnnotatedClassInjector in project grails-core by grails.

the class AbstractArtefactTypeAstTransformation method performInjectionOnArtefactType.

protected void performInjectionOnArtefactType(SourceUnit sourceUnit, ClassNode cNode, String artefactType) {
    try {
        ClassInjector[] classInjectors = GrailsAwareInjectionOperation.getClassInjectors();
        List<ClassInjector> injectors = ArtefactTypeAstTransformation.findInjectors(artefactType, classInjectors);
        if (!injectors.isEmpty()) {
            AbstractGrailsArtefactTransformer.addToTransformedClasses(cNode.getName());
            for (ClassInjector injector : injectors) {
                if (injector instanceof AllArtefactClassInjector) {
                    injector.performInjection(sourceUnit, cNode);
                } else if (injector instanceof AnnotatedClassInjector) {
                    ((AnnotatedClassInjector) injector).performInjectionOnAnnotatedClass(sourceUnit, null, cNode);
                }
            }
        }
    } catch (RuntimeException e) {
        System.err.println("Error occurred calling AST injector [" + getClass() + "]: " + e.getMessage());
        throw e;
    }
}
Also used : AllArtefactClassInjector(grails.compiler.ast.AllArtefactClassInjector) AnnotatedClassInjector(grails.compiler.ast.AnnotatedClassInjector) AnnotatedClassInjector(grails.compiler.ast.AnnotatedClassInjector) ClassInjector(grails.compiler.ast.ClassInjector) AllArtefactClassInjector(grails.compiler.ast.AllArtefactClassInjector)

Aggregations

AllArtefactClassInjector (grails.compiler.ast.AllArtefactClassInjector)1 AnnotatedClassInjector (grails.compiler.ast.AnnotatedClassInjector)1 ClassInjector (grails.compiler.ast.ClassInjector)1