use of grails.compiler.ast.AllArtefactClassInjector 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;
}
}
Aggregations