public class ArtefactHandlerAdapter extends java.lang.Object implements ArtefactHandler
Constructor and Description |
---|
ArtefactHandlerAdapter(java.lang.String type,
java.lang.Class<?> grailsClassType,
java.lang.Class<?> grailsClassImpl,
java.lang.String artefactSuffix) |
ArtefactHandlerAdapter(java.lang.String type,
java.lang.Class<?> grailsClassType,
java.lang.Class<?> grailsClassImpl,
java.lang.String artefactSuffix,
boolean allowAbstract) |
Modifier and Type | Method and Description |
---|---|
GrailsClass |
getArtefactForFeature(java.lang.Object feature)
Called to retrieve an artefact relating to some other key for example a URI or tag name
|
java.lang.String |
getPluginName()
Obtains the plugin name that deals with this artefact.
|
java.lang.String |
getType()
Implementations must return a name such as "Domain" to indicate the type of artefact they represent.
|
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 |
isArtefact(java.lang.Class aClass)
Called by the GrailsApplication whenever it needs to know if a given class
is considered to be the kind of artefact represented by this handler.
|
boolean |
isArtefactClass(java.lang.Class clazz)
Checks that class's name ends in the suffix specified for this handler.
|
boolean |
isArtefactGrailsClass(GrailsClass artefactGrailsClass)
Called to check if the specified GrailsClass is one managed by this artefact handler
|
GrailsClass |
newArtefactClass(java.lang.Class artefactClass)
Creates new GrailsClass derived object using the type supplied in constructor.
|
public ArtefactHandlerAdapter(java.lang.String type, java.lang.Class<?> grailsClassType, java.lang.Class<?> grailsClassImpl, java.lang.String artefactSuffix)
public ArtefactHandlerAdapter(java.lang.String type, java.lang.Class<?> grailsClassType, java.lang.Class<?> grailsClassImpl, java.lang.String artefactSuffix, boolean allowAbstract)
public java.lang.String getPluginName()
ArtefactHandler
getPluginName
in interface ArtefactHandler
public java.lang.String getType()
ArtefactHandler
getType
in interface ArtefactHandler
public final boolean isArtefact(java.lang.Class aClass)
ArtefactHandler
Called by the GrailsApplication whenever it needs to know if a given class is considered to be the kind of artefact represented by this handler.
Typically you will check the name of the class and some other properties to see if it is of the correct artefact type
isArtefact
in interface ArtefactHandler
aClass
- A class to testpublic boolean isArtefactClass(java.lang.Class clazz)
Checks that class's name ends in the suffix specified for this handler.
Override for more complex criteria
clazz
- The class to checkpublic GrailsClass newArtefactClass(java.lang.Class artefactClass)
Creates new GrailsClass derived object using the type supplied in constructor. May not perform optimally but is a convenience.
newArtefactClass
in interface ArtefactHandler
artefactClass
- Creates a new artefact for the given classpublic void initialize(ArtefactInfo artefacts)
initialize
in interface ArtefactHandler
artefacts
- The collection of artefact classes for this handlerpublic GrailsClass getArtefactForFeature(java.lang.Object feature)
ArtefactHandler
Called to retrieve an artefact relating to some other key for example a URI or tag name
Handlers are responsible for caching the appropriate information using the data passed to them in calls to initialize()
getArtefactForFeature
in interface ArtefactHandler
feature
- Any object that acts as a keypublic boolean isArtefactGrailsClass(GrailsClass artefactGrailsClass)
ArtefactHandler
Called to check if the specified GrailsClass is one managed by this artefact handler
isArtefactGrailsClass
in interface ArtefactHandler
artefactGrailsClass
- A GrailsClass instance