@Slf4j @CompileStatic class GormEnhancer extends Object implements Closeable
Enhances a class with GORM behavior
| Modifiers | Name | Description |
|---|---|---|
class |
GormEnhancer.1 |
| Type | Name and description |
|---|---|
Datastore |
datastore |
boolean |
dynamicEnhanceWhether to enhance classes dynamically using meta programming as well, only necessary for Java classes |
boolean |
failOnError |
List<FinderMethod> |
finders |
boolean |
includeExternalWhether to include external entities |
boolean |
markDirty |
org.springframework.transaction.PlatformTransactionManager |
transactionManager |
| Constructor and description |
|---|
GormEnhancer(Datastore datastore) |
GormEnhancer(Datastore datastore, org.springframework.transaction.PlatformTransactionManager transactionManager, boolean failOnError, boolean dynamicEnhance, boolean markDirty) |
GormEnhancer(Datastore datastore, org.springframework.transaction.PlatformTransactionManager transactionManager, ConnectionSourceSettings settings)Construct a new GormEnhancer for the given arguments |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected void |
addInstanceMethods(PersistentEntity e, boolean onlyExtendedMethods) |
|
protected void |
addStaticMethods(PersistentEntity e, boolean onlyExtendedMethods) |
|
List<String> |
allQualifiers(Datastore datastore, PersistentEntity entity)Obtain all of the qualifiers (typically the connection names) for the datastore and entity |
|
protected boolean |
appliesToDatastore(Datastore datastore, PersistentEntity entity) |
|
void |
close()Closes the enhancer clearing any stored static state |
|
protected List<FinderMethod> |
createDynamicFinders() |
|
protected List<FinderMethod> |
createDynamicFinders(Datastore targetDatastore) |
|
static GormQueryOperations |
createNamedQuery(Class entity, String queryName)Finds a named query for the given entity |
|
static GormQueryOperations |
createNamedQuery(Class entity, String queryName, Object[] args)Finds a named query for the given entity |
|
protected static boolean |
doesRealMethodExist(MetaClass mc, String methodName, Class[] parameterTypes, boolean staticScope) |
|
void |
enhance(boolean onlyExtendedMethods)Enhances all persistent entities. |
|
void |
enhance(PersistentEntity e, boolean onlyExtendedMethods)Enhance and individual entity |
|
static Datastore |
findDatastore(Class entity, String qualifier)Find a datastore for the give entity type and qualifier (the connection name) |
|
static Datastore |
findDatastoreByType(Class<? extends Datastore> datastoreType)Finds a datastore by type |
|
static PersistentEntity |
findEntity(Class entity, String qualifier)Find the entity for the given type |
<D> |
static GormInstanceApi<D> |
findInstanceApi(Class<D> entity, String qualifier)Find an instance API for the give entity type and qualifier (the connection name) |
|
static GormQueryOperations |
findNamedQuery(Class entity, String queryName)
|
|
static Datastore |
findSingleDatastore()Finds a single datastore |
|
static org.springframework.transaction.PlatformTransactionManager |
findSingleTransactionManager(String connectionName)Finds a single available transaction manager |
<D> |
static GormStaticApi<D> |
findStaticApi(Class<D> entity, String qualifier)Find a static API for the give entity type and qualifier (the connection name) |
|
protected static String |
findTenantId(Class entity)Find the tenant id for the given entity |
|
static org.springframework.transaction.PlatformTransactionManager |
findTransactionManager(Class<? extends Datastore> datastoreType, String connectionName)Finds a single available transaction manager |
<D> |
static GormValidationApi<D> |
findValidationApi(Class<D> entity, String qualifier)Find a validation API for the give entity type and qualifier (the connection name) |
|
List<FinderMethod> |
getFinders() |
<D> |
protected GormInstanceApi<D> |
getInstanceApi(Class<D> cls, String qualifier) |
<D> |
protected List<AbstractGormApi<D>> |
getInstanceMethodApiProviders(Class<D> cls) |
<D> |
protected GormStaticApi<D> |
getStaticApi(Class<D> cls, String qualifier) |
<D> |
protected GormValidationApi<D> |
getValidationApi(Class<D> cls, String qualifier) |
|
protected static boolean |
isRealMethod(MetaMethod existingMethod) |
|
protected void |
registerConstraints(Datastore datastore) |
|
void |
registerEntity(PersistentEntity entity)Registers a new entity with the GORM enhancer |
|
protected Object |
registerInstanceMethod(Class cls, ExpandoMetaClass mc, AbstractGormApi apiProvider, String methodName, Class[] parameterTypes) |
|
protected void |
registerStaticMethod(ExpandoMetaClass mc, String methodName, Class<?>[] parameterTypes, GormStaticApi staticApiProvider) |
Whether to enhance classes dynamically using meta programming as well, only necessary for Java classes
Whether to include external entities
Construct a new GormEnhancer for the given arguments
datastore - The datastoretransactionManager - The transaction managersettings - The settingsObtain 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
Finds a named query for the given entity
entity - The entity namequeryName - The query nameFinds a named query for the given entity
entity - The entity namequeryName - The query nameEnhances 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 APIsFind a datastore for the give entity type and qualifier (the connection name)
entity - The entity classqualifier - The qualifierFinds a datastore by type
datastoreType - The datastore typeFind the entity for the given type
entity - The entity classqualifier - The qualifierFind an instance API for the give entity type and qualifier (the connection name)
entity - The entity classqualifier - The qualifierFinds a single datastore
Finds a single available transaction manager
Find a static API for the give entity type and qualifier (the connection name)
entity - The entity classqualifier - The qualifierFind the tenant id for the given entity @return
Finds a single available transaction manager
Find a validation API for the give entity type and qualifier (the connection name)
entity - The entity classqualifier - The qualifierRegisters a new entity with the GORM enhancer
entity - The entityGroovy Documentation