Package org.grails.core.artefact
Class DomainClassArtefactHandler
- java.lang.Object
-
- grails.core.ArtefactHandlerAdapter
-
- org.grails.core.artefact.DomainClassArtefactHandler
-
- All Implemented Interfaces:
ArtefactHandler,GrailsApplicationAware,org.springframework.beans.factory.Aware,org.springframework.core.Ordered
- Direct Known Subclasses:
AnnotationDomainClassArtefactHandler
public class DomainClassArtefactHandler extends ArtefactHandlerAdapter implements GrailsApplicationAware, org.springframework.core.Ordered
Evaluates the conventions that define a domain class in Grails.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPLUGIN_NAMEstatic java.lang.StringTYPE-
Fields inherited from class grails.core.ArtefactHandlerAdapter
allowAbstract, artefactSuffix, grailsClassImpl, grailsClassType, type
-
-
Constructor Summary
Constructors Constructor Description DomainClassArtefactHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetOrder()java.lang.StringgetPluginName()Obtains the plugin name that deals with this artefact.booleanisArtefact(org.codehaus.groovy.ast.ClassNode classNode)Default implementation ofArtefactHandler.isArtefact(org.codehaus.groovy.ast.ClassNode)which returns true if the ClassNode passes theArtefactHandlerAdapter.isArtefactResource(org.grails.io.support.Resource)method and the name of the ClassNode ends with theArtefactHandlerAdapter.artefactSuffixbooleanisArtefactClass(java.lang.Class clazz)Checks that class's name ends in the suffix specified for this handler.protected booleanisArtefactResource(org.grails.io.support.Resource resource)Subclasses can override to narrow down whether the given resource is an artefact of this type.static booleanisDomainClass(java.lang.Class<?> clazz)static booleanisDomainClass(java.lang.Class<?> clazz, boolean allowProxyClass)protected booleanisValidArtefactClassNode(org.codehaus.groovy.ast.ClassNode classNode, int modifiers)GrailsClassnewArtefactClass(java.lang.Class artefactClass)Creates new GrailsClass derived object using the type supplied in constructor.GrailsClassnewArtefactClass(java.lang.Class artefactClass, org.grails.datastore.mapping.model.MappingContext mappingContext)voidsetGrailsApplication(GrailsApplication grailsApplication)This method is called by theApplicationContextthat loads the Grails application.-
Methods inherited from class grails.core.ArtefactHandlerAdapter
getArtefactForFeature, getType, initialize, isArtefact, isArtefactGrailsClass
-
-
-
-
Field Detail
-
TYPE
public static final java.lang.String TYPE
- See Also:
- Constant Field Values
-
PLUGIN_NAME
public static final java.lang.String PLUGIN_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
setGrailsApplication
public void setGrailsApplication(GrailsApplication grailsApplication)
Description copied from interface:GrailsApplicationAwareThis method is called by the
ApplicationContextthat loads the Grails application. TheGrailsApplicationinstance that represents the loaded Grails application is injected.- Specified by:
setGrailsApplicationin interfaceGrailsApplicationAware- Parameters:
grailsApplication- theGrailsApplicationobject that represents this Grails application
-
getPluginName
public java.lang.String getPluginName()
Description copied from interface:ArtefactHandlerObtains the plugin name that deals with this artefact.- Specified by:
getPluginNamein interfaceArtefactHandler- Overrides:
getPluginNamein classArtefactHandlerAdapter- Returns:
- The plugin name or null if there isn't one
-
newArtefactClass
public GrailsClass newArtefactClass(java.lang.Class artefactClass)
Description copied from class:ArtefactHandlerAdapterCreates new GrailsClass derived object using the type supplied in constructor. May not perform optimally but is a convenience.
- Specified by:
newArtefactClassin interfaceArtefactHandler- Overrides:
newArtefactClassin classArtefactHandlerAdapter- Parameters:
artefactClass- Creates a new artefact for the given class- Returns:
- An instance of the GrailsClass interface representing the artefact
-
newArtefactClass
public GrailsClass newArtefactClass(java.lang.Class artefactClass, org.grails.datastore.mapping.model.MappingContext mappingContext)
-
isArtefactResource
protected boolean isArtefactResource(org.grails.io.support.Resource resource) throws java.io.IOExceptionDescription copied from class:ArtefactHandlerAdapterSubclasses can override to narrow down whether the given resource is an artefact of this type. The default is to consider all files under "grails-app" to be a resource- Overrides:
isArtefactResourcein classArtefactHandlerAdapter- Parameters:
resource- The resource- Returns:
- True if it is a Grails artefact
- Throws:
java.io.IOException
-
isValidArtefactClassNode
protected boolean isValidArtefactClassNode(org.codehaus.groovy.ast.ClassNode classNode, int modifiers)- Overrides:
isValidArtefactClassNodein classArtefactHandlerAdapter
-
isArtefact
public boolean isArtefact(org.codehaus.groovy.ast.ClassNode classNode)
Description copied from class:ArtefactHandlerAdapterDefault implementation ofArtefactHandler.isArtefact(org.codehaus.groovy.ast.ClassNode)which returns true if the ClassNode passes theArtefactHandlerAdapter.isArtefactResource(org.grails.io.support.Resource)method and the name of the ClassNode ends with theArtefactHandlerAdapter.artefactSuffix- Specified by:
isArtefactin interfaceArtefactHandler- Overrides:
isArtefactin classArtefactHandlerAdapter- Parameters:
classNode- The ClassNode instance- Returns:
- True if the ClassNode is an artefact of this type
-
isArtefactClass
public boolean isArtefactClass(java.lang.Class clazz)
Description copied from class:ArtefactHandlerAdapterChecks that class's name ends in the suffix specified for this handler.
Override for more complex criteria
- Overrides:
isArtefactClassin classArtefactHandlerAdapter- Parameters:
clazz- The class to check- Returns:
- true if it is an artefact of this type
-
isDomainClass
public static boolean isDomainClass(java.lang.Class<?> clazz, boolean allowProxyClass)
-
isDomainClass
public static boolean isDomainClass(java.lang.Class<?> clazz)
-
getOrder
public int getOrder()
- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
-