org.codehaus.groovy.grails.compiler.injection
Class DefaultGrailsDomainClassInjector

java.lang.Object
  extended by org.codehaus.groovy.grails.compiler.injection.DefaultGrailsDomainClassInjector
All Implemented Interfaces:
ClassInjector, GrailsDomainClassInjector

public class DefaultGrailsDomainClassInjector
extends Object
implements GrailsDomainClassInjector

Default implementation of domain class injector interface that adds the 'id' and 'version' properties and other previously boilerplate code

Since:
0.2

Created: 20th June 2006

Author:
Graeme Rocher

Constructor Summary
DefaultGrailsDomainClassInjector()
           
 
Method Summary
protected  boolean isDomainClass(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.control.SourceUnit sourceNode)
           
 void performInjection(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.ClassNode classNode)
          Method that handles injection of properties, methods etc. into a class
 void performInjection(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context, org.codehaus.groovy.ast.ClassNode classNode)
          Method that handles injection of properties, methods etc. into a class
 void performInjectionOnAnnotatedEntity(org.codehaus.groovy.ast.ClassNode classNode)
          This method doesn't check with the specified ClassNode is a valid entity and assumes it is and proceeds with the injection regardless
 boolean shouldInject(URL url)
          Returns whether this injector should inject
protected  boolean shouldInjectClass(org.codehaus.groovy.ast.ClassNode classNode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGrailsDomainClassInjector

public DefaultGrailsDomainClassInjector()
Method Detail

performInjection

public void performInjection(org.codehaus.groovy.control.SourceUnit source,
                             org.codehaus.groovy.classgen.GeneratorContext context,
                             org.codehaus.groovy.ast.ClassNode classNode)
Description copied from interface: ClassInjector
Method that handles injection of properties, methods etc. into a class

Specified by:
performInjection in interface ClassInjector
Parameters:
source - The source unit
context - The generator context
classNode - The ClassNode instance

performInjectionOnAnnotatedEntity

public void performInjectionOnAnnotatedEntity(org.codehaus.groovy.ast.ClassNode classNode)
Description copied from interface: GrailsDomainClassInjector
This method doesn't check with the specified ClassNode is a valid entity and assumes it is and proceeds with the injection regardless

Specified by:
performInjectionOnAnnotatedEntity in interface GrailsDomainClassInjector
Parameters:
classNode - The ClassNode

shouldInject

public boolean shouldInject(URL url)
Description copied from interface: ClassInjector
Returns whether this injector should inject

Specified by:
shouldInject in interface ClassInjector
Parameters:
url - The URL of the source file
Returns:
True if injection should occur

isDomainClass

protected boolean isDomainClass(org.codehaus.groovy.ast.ClassNode classNode,
                                org.codehaus.groovy.control.SourceUnit sourceNode)

shouldInjectClass

protected boolean shouldInjectClass(org.codehaus.groovy.ast.ClassNode classNode)

performInjection

public void performInjection(org.codehaus.groovy.control.SourceUnit source,
                             org.codehaus.groovy.ast.ClassNode classNode)
Description copied from interface: ClassInjector
Method that handles injection of properties, methods etc. into a class

Specified by:
performInjection in interface ClassInjector
Parameters:
source - The source unit
classNode - The ClassNode instance


Copyright (c) 2005-2009 The Grails project