@groovy.util.logging.Slf4j @groovy.transform.CompileStatic class GormEnhancer extends java.lang.Object
Enhances a class with GORM behavior
Type | Name and description |
---|---|
Datastore |
datastore |
boolean |
dynamicEnhance Whether to enhance classes dynamically using meta programming as well, only necessary for Java classes |
boolean |
failOnError |
java.util.List<FinderMethod> |
finders |
boolean |
includeExternal Whether to include external entities |
org.springframework.transaction.PlatformTransactionManager |
transactionManager |
Constructor and description |
---|
GormEnhancer
(Datastore datastore) |
GormEnhancer
(Datastore datastore, org.springframework.transaction.PlatformTransactionManager transactionManager, boolean failOnError = false, boolean dynamicEnhance = false) |
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) |
|
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 |
|
protected boolean |
appliesToDatastore(Datastore datastore, PersistentEntity 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) |
|
protected static boolean |
doesRealMethodExist(groovy.lang.MetaClass mc, java.lang.String methodName, java.lang.Class[] parameterTypes, boolean staticScope) |
|
void |
enhance(boolean onlyExtendedMethods = false) Enhances all persistent entities. |
|
void |
enhance(PersistentEntity e, boolean onlyExtendedMethods = false) Enhance and individual entity |
|
static Datastore |
findDatastore(java.lang.Class entity, java.lang.String qualifier = findTenantId(entity) Find a datastore for the give entity type and qualifier (the connection name) |
|
static Datastore |
findDatastoreByType(java.lang.Class<? extends Datastore> datastoreType) Finds a datastore by type |
|
static PersistentEntity |
findEntity(java.lang.Class entity, java.lang.String qualifier = findTenantId(entity) Find the entity for the given type |
<D> |
static GormInstanceApi<D> |
findInstanceApi(java.lang.Class<D> entity, java.lang.String qualifier = findTenantId(entity) Find an instance API for the give entity type and qualifier (the connection name) |
|
static GormQueryOperations |
findNamedQuery(java.lang.Class entity, java.lang.String queryName) Finds a named query for the given entity |
|
static Datastore |
findSingleDatastore() Finds a single datastore |
|
static org.springframework.transaction.PlatformTransactionManager |
findSingleTransactionManager(java.lang.String connectionName = ConnectionSource.DEFAULT) Finds a single available transaction manager |
<D> |
static GormStaticApi<D> |
findStaticApi(java.lang.Class<D> entity, java.lang.String qualifier = findTenantId(entity) Find a static API for the give entity type and qualifier (the connection name) |
|
protected static java.lang.String |
findTenantId(java.lang.Class entity) Find the tenant id for the given entity |
|
static org.springframework.transaction.PlatformTransactionManager |
findTransactionManager(java.lang.Class<? extends Datastore> datastoreType, java.lang.String connectionName = ConnectionSource.DEFAULT) Finds a single available transaction manager |
<D> |
static GormValidationApi<D> |
findValidationApi(java.lang.Class<D> entity, java.lang.String qualifier = findTenantId(entity) Find a validation API for the give entity type and qualifier (the connection name) |
|
java.util.List<FinderMethod> |
getFinders() |
<D> |
protected GormInstanceApi<D> |
getInstanceApi(java.lang.Class<D> cls, java.lang.String qualifier = ConnectionSource.DEFAULT) |
<D> |
protected java.util.List<AbstractGormApi<D>> |
getInstanceMethodApiProviders(java.lang.Class<D> cls) |
<D> |
protected GormStaticApi<D> |
getStaticApi(java.lang.Class<D> cls, java.lang.String qualifier = ConnectionSource.DEFAULT) |
<D> |
protected GormValidationApi<D> |
getValidationApi(java.lang.Class<D> cls, java.lang.String qualifier = ConnectionSource.DEFAULT) |
|
protected static boolean |
isRealMethod(groovy.lang.MetaMethod existingMethod) |
|
protected void |
registerConstraints(Datastore datastore) |
|
void |
registerEntity(PersistentEntity entity) Registers a new entity with the GORM enhancer |
|
protected java.lang.Object |
registerInstanceMethod(java.lang.Class cls, groovy.lang.ExpandoMetaClass mc, AbstractGormApi apiProvider, java.lang.String methodName, java.lang.Class[] parameterTypes) |
|
protected void |
registerStaticMethod(groovy.lang.ExpandoMetaClass mc, java.lang.String methodName, java.lang.Class<?>[] parameterTypes, GormStaticApi staticApiProvider) |
|
protected void |
removeConstraints() |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
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
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 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 named query for the given entity
entity
- The entity namequeryName
- The query nameFinds 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
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 entity