Package grails.core

Interface ArtefactHandler

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method 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)
      Called whenever the list of artefacts has changed or been reloaded.
      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 isArtefact​(org.codehaus.groovy.ast.ClassNode classNode)  
      boolean isArtefactGrailsClass​(GrailsClass artefactGrailsClass)
      Called to check if the specified GrailsClass is one managed by this artefact handler
      GrailsClass newArtefactClass​(java.lang.Class artefactClass)
      Called by GrailsApplication when a new class is found and a GrailsClass wrapping it is required
    • Method Detail

      • getPluginName

        java.lang.String getPluginName()
        Obtains the plugin name that deals with this artefact.
        Returns:
        The plugin name or null if there isn't one
      • getType

        java.lang.String getType()
        Implementations must return a name such as "Domain" to indicate the type of artefact they represent.
        Returns:
        The aretfact type, as a String
      • isArtefact

        boolean isArtefact​(org.codehaus.groovy.ast.ClassNode classNode)
        Parameters:
        classNode - The ClassNode instance
        Returns:
        True if the given ClassNode instance is an instance of the Artefact type
      • isArtefact

        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.

        Typically you will check the name of the class and some other properties to see if it is of the correct artefact type

        Parameters:
        aClass - A class to test
        Returns:
        true if the class looks like one of your artefacts
      • newArtefactClass

        GrailsClass newArtefactClass​(java.lang.Class artefactClass)

        Called by GrailsApplication when a new class is found and a GrailsClass wrapping it is required

        Parameters:
        artefactClass - The new class that has been loaded
        Returns:
        A new custom GrailsClass wrapper containing any extra information your artefact type requires
      • initialize

        void initialize​(ArtefactInfo artefacts)

        Called whenever the list of artefacts has changed or been reloaded.

        It must be safe to call this method multiple times and have any internal data structures reset.

        Parameters:
        artefacts - The collection of artefact classes for this handler
      • getArtefactForFeature

        GrailsClass getArtefactForFeature​(java.lang.Object feature)

        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()

        Parameters:
        feature - Any object that acts as a key
        Returns:
        A matching artefact GrailsClass or null if there is no match for this feature ID
      • isArtefactGrailsClass

        boolean isArtefactGrailsClass​(GrailsClass artefactGrailsClass)

        Called to check if the specified GrailsClass is one managed by this artefact handler

        Parameters:
        artefactGrailsClass - A GrailsClass instance
        Returns:
        true if this handler manages the specified GrailsClass