final class HQLHelperCache
extends java.lang.Object
HQLHelper
objects mapped to a complex key which encompasses the DMO
implementation class, base where clause, Hibernate substitution types, restriction sorting,
foreign key information, and whether or not the query is a project query.
An HQLHelper
instance is retrieved using the get(java.lang.Class<?>, org.hibernate.type.Type[], boolean, java.lang.String, java.lang.String, java.lang.Class<?>)
method; it is stored
in the cache using the put(java.lang.Class<?>, org.hibernate.type.Type[], boolean, java.lang.String, java.lang.String, java.lang.Class<?>, com.goldencode.p2j.persist.HQLHelper)
method.
Modifier and Type | Class and Description |
---|---|
private static class |
HQLHelperCache.Key
HQLHelper hashable lookup key. |
Modifier and Type | Field and Description |
---|---|
private LFUAgingCache<HQLHelperCache.Key,HQLHelper> |
cache
LFU cache of HQL helper objects, which also ages its entries
|
Constructor and Description |
---|
HQLHelperCache()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
(package private) HQLHelper |
get(java.lang.Class<?> dmoIface,
org.hibernate.type.Type[] types,
boolean idOnly,
java.lang.String where,
java.lang.String sort,
java.lang.Class<?> joinIface)
Attempt to retrieve an
HQLHelper from the cache. |
(package private) void |
put(java.lang.Class<?> dmoIface,
org.hibernate.type.Type[] types,
boolean idOnly,
java.lang.String where,
java.lang.String sort,
java.lang.Class<?> joinIface,
HQLHelper helper)
Store an
HQLHelper in the cache. |
private final LFUAgingCache<HQLHelperCache.Key,HQLHelper> cache
HQLHelper get(java.lang.Class<?> dmoIface, org.hibernate.type.Type[] types, boolean idOnly, java.lang.String where, java.lang.String sort, java.lang.Class<?> joinIface)
HQLHelper
from the cache.dmoIface
- DMO interface associated with the helper. May not be null
.types
- Hibernate types of query substitution parameters. May be an empty array, but may
not be null
.idOnly
- Indicates whether query is a projection query returning the primary key ID only.where
- Where clause of a query. May be null
.sort
- Order by clause of a query. May be null
.joinIface
- Interface DMO associated within query by foreign key. May be null
.HQLHelper
instance or null
if an existing
instance was not found in the cache.void put(java.lang.Class<?> dmoIface, org.hibernate.type.Type[] types, boolean idOnly, java.lang.String where, java.lang.String sort, java.lang.Class<?> joinIface, HQLHelper helper)
HQLHelper
in the cache.dmoIface
- DMO interface associated with the helper. May not be null
.types
- Hibernate types of query substitution parameters. May be an empty array, but may
not be null
.idOnly
- Indicates whether query is a projection query returning the primary key ID only.where
- Where clause of a query. May be null
.sort
- Order by clause of a query. May be null
.joinIface
- Interface DMO associated within query by foreign key. May be null
.helper
- HQLHelper
instance to be cached.