use of grails.compiler.ast.GrailsDomainClassInjector in project grails-core by grails.
the class EntityASTTransformation method applyTransformation.
public void applyTransformation(SourceUnit sourceUnit, ClassNode classNode) {
if (GrailsASTUtils.isApplied(classNode, EntityASTTransformation.class)) {
return;
}
GrailsASTUtils.markApplied(classNode, EntityASTTransformation.class);
GrailsDomainClassInjector domainInjector = new DefaultGrailsDomainClassInjector();
domainInjector.performInjectionOnAnnotatedEntity(classNode);
ClassInjector[] classInjectors = GrailsAwareInjectionOperation.getClassInjectors();
final List<ClassInjector> domainInjectors = ArtefactTypeAstTransformation.findInjectors(DomainClassArtefactHandler.TYPE, classInjectors);
for (ClassInjector injector : domainInjectors) {
try {
injector.performInjection(sourceUnit, classNode);
} catch (RuntimeException e) {
try {
System.err.println("Error occurred calling AST injector [" + injector.getClass().getName() + "]: " + e.getMessage());
} catch (Throwable t) {
// ignore
}
throw e;
}
}
if (compilationUnit != null) {
TraitInjectionUtils.processTraitsForNode(sourceUnit, classNode, DomainClassArtefactHandler.TYPE, compilationUnit);
}
}
Aggregations