@groovy.transform.CompileStatic class GormEnhancer extends java.lang.Object implements java.io.Closeable
Enhances a class with GORM methods
| Type | Name and description |
|---|---|
Datastore |
datastore |
boolean |
dynamicEnhanceWhether to enhance classes dynamically using meta programming as well, only necessary for Java classes |
boolean |
failOnError |
boolean |
includeExternalWhether to include external entities |
boolean |
markDirty |
PlatformTransactionManager |
transactionManagerRetained for API compatibility. |
| Constructor and description |
|---|
GormEnhancer(Datastore datastore) |
GormEnhancer(Datastore datastore, PlatformTransactionManager transactionManager, boolean failOnError, boolean dynamicEnhance, boolean markDirty) |
GormEnhancer(Datastore datastore, PlatformTransactionManager transactionManager, ConnectionSourceSettings settings, GormRegistry registry)Construct a new GormEnhancer for the given arguments. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected void |
addInstanceMethods(PersistentEntity e) |
|
protected void |
addStaticMethods(PersistentEntity e) |
|
java.util.List<java.lang.String> |
allQualifiers(Datastore datastore, PersistentEntity entity)Obtain all of the qualifiers (typically the connection names) for the datastore and entity |
|
void |
close()Closes the enhancer clearing any stored static state |
|
protected java.util.List<FinderMethod> |
createDynamicFinders() |
|
protected java.util.List<FinderMethod> |
createDynamicFinders(Datastore targetDatastore) |
|
void |
enhance(boolean onlyExtendedMethods)Enhances all persistent entities. |
|
void |
enhance(PersistentEntity e, boolean onlyExtendedMethods)Enhance and individual entity |
|
static Datastore |
findDatastore(java.lang.Class entity) |
|
static Datastore |
findDatastore(java.lang.Class entity, java.lang.String qualifier) |
|
static PersistentEntity |
findEntity(java.lang.Class entity) |
<D> |
static GormInstanceApi<D> |
findInstanceApi(java.lang.Class<D> entity) |
<D> |
static GormInstanceApi<D> |
findInstanceApi(java.lang.Class<D> entity, java.lang.String qualifier) |
<D> |
static GormStaticApi<D> |
findStaticApi(java.lang.Class<D> entity) |
<D> |
static GormStaticApi<D> |
findStaticApi(java.lang.Class<D> entity, java.lang.String qualifier) |
<D> |
static GormValidationApi<D> |
findValidationApi(java.lang.Class<D> entity) |
<D> |
static GormValidationApi<D> |
findValidationApi(java.lang.Class<D> entity, java.lang.String qualifier) |
|
java.util.List<java.lang.String> |
getConnectionSourceNames() |
<D> |
protected GormInstanceApi<D> |
getInstanceApi(java.lang.Class<D> cls, java.lang.String qualifier) |
|
static GormRegistry |
getRegistry()
|
<D> |
protected GormStaticApi<D> |
getStaticApi(java.lang.Class<D> cls, java.lang.String qualifier) |
<D> |
protected GormValidationApi<D> |
getValidationApi(java.lang.Class<D> cls, java.lang.String qualifier) |
|
protected void |
registerApiFactories()Registers the GormApiFactory implementations this enhancer's datastore needs, before any entity is registered. |
|
protected void |
registerConstraints(Datastore datastore) |
|
void |
registerEntity(PersistentEntity entity)Registers a new entity with the GORM enhancer |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Whether to enhance classes dynamically using meta programming as well, only necessary for Java classes
Whether to include external entities
Retained for API compatibility. The registry-based enhancer no longer uses the transaction manager directly; obtain it from the GORM APIs instead.
Construct a new GormEnhancer for the given arguments.
datastore - The datastore (required)transactionManager - Retained for constructor compatibilitysettings - The connection source settings (required)registry - The GORM registry (optional, defaults to singleton instance)Obtain all of the qualifiers (typically the connection names) for the datastore and entity
datastore - The datastoreentity - The entityCloses the enhancer clearing any stored static state
Enhances all persistent entities.
onlyExtendedMethods - If only to add additional methods provides by subclasses of the GORM APIsEnhance and individual entity
e - The entityonlyExtendedMethods - If only to add additional methods provides by subclasses of the GORM APIs
Registers the GormApiFactory implementations this enhancer's datastore needs, before any
entity is registered.
Adapters that build specialised API objects (for example Mongo's MongoStaticApi, which
MongoEntity casts to) override this. It is deliberately separate from
registerConstraints(Datastore): factory registration has nothing to do with constraints,
and hanging it off the constraints hook would break the moment a subclass reordered or skipped
that step.
Registers a new entity with the GORM enhancer
entity - The entity