org.codehaus.groovy.grails.commons
Class DomainClassArtefactHandler

java.lang.Object
  extended by org.codehaus.groovy.grails.commons.ArtefactHandlerAdapter
      extended by org.codehaus.groovy.grails.commons.DomainClassArtefactHandler
All Implemented Interfaces:
ArtefactHandler, GrailsConfigurationAware
Direct Known Subclasses:
AnnotationDomainClassArtefactHandler

public class DomainClassArtefactHandler
extends ArtefactHandlerAdapter
implements GrailsConfigurationAware

Evaluates the conventions that define a domain class in Grails

Author:
Graeme Rocher, Marc Palmer (marc@anyware.co.uk)

Field Summary
static String TYPE
           
 
Fields inherited from class org.codehaus.groovy.grails.commons.ArtefactHandlerAdapter
log
 
Constructor Summary
DomainClassArtefactHandler()
           
 
Method Summary
 Map getDefaultConstraints()
           
 void initialize(ArtefactInfo artefacts)
          Sets up the relationships between the domain classes, this has to be done after the intial creation to avoid looping
 boolean isArtefactClass(Class clazz)
          Checks that class's name ends in the suffix specified for this handler.
static boolean isDomainClass(Class clazz)
           
 GrailsClass newArtefactClass(Class artefactClass)
          Creates new GrailsClass derived object using the type supplied in constructor.
 void setConfiguration(groovy.util.ConfigObject co)
           
 
Methods inherited from class org.codehaus.groovy.grails.commons.ArtefactHandlerAdapter
getArtefactForFeature, getPluginName, getType, isArtefact, isArtefactGrailsClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final String TYPE
See Also:
Constant Field Values
Constructor Detail

DomainClassArtefactHandler

public DomainClassArtefactHandler()
Method Detail

newArtefactClass

public GrailsClass newArtefactClass(Class artefactClass)
Description copied from class: ArtefactHandlerAdapter

Creates new GrailsClass derived object using the type supplied in constructor. May not perform optimally but is a convenience.

Specified by:
newArtefactClass in interface ArtefactHandler
Overrides:
newArtefactClass in class ArtefactHandlerAdapter
Parameters:
artefactClass - Creates a new artefact for the given class
Returns:
An instance of the GrailsClass interface representing the artefact

getDefaultConstraints

public Map getDefaultConstraints()

initialize

public void initialize(ArtefactInfo artefacts)
Sets up the relationships between the domain classes, this has to be done after the intial creation to avoid looping

Specified by:
initialize in interface ArtefactHandler
Overrides:
initialize in class ArtefactHandlerAdapter
Parameters:
artefacts - The collection of artefact classes for this handler

isArtefactClass

public boolean isArtefactClass(Class clazz)
Description copied from class: ArtefactHandlerAdapter

Checks that class's name ends in the suffix specified for this handler.

Override for more complex criteria

Overrides:
isArtefactClass in class ArtefactHandlerAdapter
Parameters:
clazz - The class to check
Returns:
True if it is an artefact of this type

isDomainClass

public static boolean isDomainClass(Class clazz)

setConfiguration

public void setConfiguration(groovy.util.ConfigObject co)
Specified by:
setConfiguration in interface GrailsConfigurationAware


Copyright (c) 2005-2009 The Grails project