grace-api module serves as the core API layer for the Grace Framework, containing fundamental interfaces that other modules depend on.
It now focuses on core interfaces that define the framework's fundamental abstractions, while implementations and concrete classes have been moved to appropriate modules like grace-core.
GrailsApplication - The primary interface representing a running Grace application, providing access to application metadata, configuration, and artefacts. Key methods include:
getConfig()- Returns the Config instancegetMainContext()- Returns the Spring context for the applicationgetMappingContext()- Returns the GORM MappingContextisArtefact(Class)- Checks if a class is a Grace artefactgetAllArtefacts()- Retrieves all artefact classesgetArtefacts(String artefactType)- Gets all GrailsClass instances for a given artefact typeregisterArtefactHandler(ArtefactHandler)- Registers a new artefact handlergetArtefactHandlers()- Obtains all registered artefact handlers
ArtefactHandler - Interface for analyzing conventions within a Grace application, responsible for identifying, creating, and initializing artefacts. Key methods include:
getType()- Returns the artefact type (e.g., "Domain", "Controller")isArtefact(Class)- Checks if a class is this type of artefactisArtefact(ClassNode)- Checks if a ClassNode is this type of artefact (for AST processing)newArtefactClass(Class)- Creates a GrailsClass wrapper for an artefactinitialize(ArtefactInfo)- Initializes when artefact list changesgetArtefactForFeature(Object)- Retrieves artefact by feature (e.g., URI, tag name)
ArtefactInfo - Holder for class-related info and structures relating to an artefact type. Provides access to:
getClasses()- Array of original artefact classesgetGrailsClasses()- Array of GrailsClass wrappersgetClassesByName()- Map of classes by namegetGrailsClassesByName()- Map of GrailsClasses by namegetGrailsClass(String name)- Retrieves a named GrailsClass
ArtefactTypes - Defines constants for standard artefact types in Grace:
APPLICATION- Application artefactBOOTSTRAP- Bootstrap artefactCONTROLLER- Controller artefactDOMAIN_CLASS- Domain class artefactSERVICE- Service artefactTAG_LIBRARY- Tag library artefactURL_MAPPINGS- URL mappings artefact
GrailsClass - Interface referenced throughout the artefact system as the wrapper class for artefact classes, providing metadata and additional information about artefacts. It is used by ArtefactHandler.newArtefactClass() to create wrappers and stored in ArtefactInfo structures.
Config - The configuration interface returned by GrailsApplication.getConfig(), providing access to application configuration properties.
Named and Described - Utility interfaces for objects that have a name and description, relocated from grace-bootstrap to grace-api in the 2024.x refactoring.