@groovy.util.logging.Slf4j @groovy.transform.CompileStatic class GormEnhancer extends java.lang.Object implements java.io.Closeable
Enhances a class with GORM behavior
Modifiers | Name | Description |
---|---|---|
class |
GormEnhancer.1 |
Modifiers | Name | Description |
---|---|---|
private static java.util.Map<java.lang.String, java.util.Map<java.lang.String, Datastore>> |
DATASTORES |
|
private static java.util.Map<java.lang.Class, Datastore> |
DATASTORES_BY_TYPE |
|
private static java.util.Map<java.lang.String, java.util.Map<java.lang.String, GormInstanceApi>> |
INSTANCE_APIS |
|
private static java.util.Map<java.lang.String, java.util.Map<java.lang.String, groovy.lang.Closure>> |
NAMED_QUERIES |
|
private static java.util.Map<java.lang.String, java.util.Map<java.lang.String, GormStaticApi>> |
STATIC_APIS |
|
private static java.util.Map<java.lang.String, java.util.Map<java.lang.String, GormValidationApi>> |
VALIDATION_APIS |
|
private Datastore |
datastore |
|
private boolean |
dynamicEnhance |
Whether to enhance classes dynamically using meta programming as well, only necessary for Java classes |
private boolean |
failOnError |
|
private java.util.List<FinderMethod> |
finders |
|
private boolean |
includeExternal |
Whether to include external entities |
private boolean |
markDirty |
|
private org.springframework.transaction.PlatformTransactionManager |
transactionManager |
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 |
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) |
|
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) |
|
private static NamedCriteriaProxy |
buildNamedCriteriaProxy(java.lang.Class entity, java.util.Map<java.lang.String, groovy.lang.Closure> namedQueries, java.lang.String queryName, java.lang.Object[] args) |
|
void |
close() Closes the enhancer clearing any stored static state |
|
protected java.util.List<FinderMethod> |
createDynamicFinders() |
|
protected java.util.List<FinderMethod> |
createDynamicFinders(Datastore targetDatastore) |
|
static GormQueryOperations |
createNamedQuery(java.lang.Class entity, java.lang.String queryName) Finds a named query for the given entity |
|
static GormQueryOperations |
createNamedQuery(java.lang.Class entity, java.lang.String queryName, java.lang.Object[] args) Finds a named query for the given entity |
|
protected static boolean |
doesRealMethodExist(groovy.lang.MetaClass mc, java.lang.String methodName, java.lang.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(java.lang.Class entity, java.lang.String qualifier) 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) Find the entity for the given type |
<D> |
static GormInstanceApi<D> |
findInstanceApi(java.lang.Class<D> entity, java.lang.String qualifier) 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)
|
|
static Datastore |
findSingleDatastore() Finds a single datastore |
|
static org.springframework.transaction.PlatformTransactionManager |
findSingleTransactionManager(java.lang.String connectionName) Finds a single available transaction manager |
<D> |
static GormStaticApi<D> |
findStaticApi(java.lang.Class<D> entity, java.lang.String qualifier) 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) Finds a single available transaction manager |
<D> |
static GormValidationApi<D> |
findValidationApi(java.lang.Class<D> entity, java.lang.String qualifier) 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) |
<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) |
|
private static org.springframework.transaction.PlatformTransactionManager |
getTransactionManagerForConnection(Datastore datastore, java.lang.String connectionName) |
<D> |
protected GormValidationApi<D> |
getValidationApi(java.lang.Class<D> cls, java.lang.String qualifier) |
|
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() |
|
private static java.lang.IllegalStateException |
stateException(java.lang.Class entity) |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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
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