public class FetchConfigurationImpl extends Object implements FetchConfiguration, Cloneable
| Modifier and Type | Class and Description |
|---|---|
protected static class |
FetchConfigurationImpl.ConfigurationState
Configurable state shared throughout a traversal chain.
|
DEFAULT, FETCH_LOAD, FETCH_NONE, FETCH_REFLOCK_NONE, LOCK_READ, LOCK_WRITELOCKSCOPE_EXTENDED, LOCKSCOPE_NORMALFLUSH_FALSE, FLUSH_TRUE, FLUSH_WITH_CONNECTION| Modifier | Constructor and Description |
|---|---|
|
FetchConfigurationImpl() |
protected |
FetchConfigurationImpl(FetchConfigurationImpl.ConfigurationState state) |
| Modifier and Type | Method and Description |
|---|---|
FetchConfiguration |
addFetchGroup(String name)
Adds
group to the set of fetch group names to
use when loading objects. |
FetchConfiguration |
addFetchGroups(Collection<String> groups)
Adds
groups to the set of fetch group names to
use when loading objects. |
FetchConfiguration |
addField(String field)
Adds
field to the set of fully-qualified field names to
use when loading objects. |
FetchConfiguration |
addFields(Collection<String> fields)
Adds
fields to the set of fully-qualified field names to
use when loading objects. |
FetchConfiguration |
clearFetchGroups()
Clears the set of fetch group names to use when loading
data.
|
FetchConfiguration |
clearFields()
Clears the set of field names to use when loading
data.
|
Object |
clone()
Clone this instance.
|
void |
copy(FetchConfiguration fetch)
Copy the state from the given fetch configuration to this one.
|
DataCacheRetrieveMode |
getCacheRetrieveMode()
Gets the current retrieve mode for data cache.
|
DataCacheStoreMode |
getCacheStoreMode()
Gets the current storage mode for data cache.
|
StoreContext |
getContext()
Return the context associated with this configuration;
may be null if it has not been set or this object has been serialized.
|
boolean |
getExtendedPathLookup()
Affirms if extended path lookup feature is active.
|
int |
getFetchBatchSize()
Return the fetch batch size for large result set support.
|
Set<String> |
getFetchGroups()
Returns immutable set of names of the fetch groups that this component
will use when loading objects.
|
Set<String> |
getFields()
Returns the set of fully-qualified field names that this component
will use when loading objects.
|
int |
getFlushBeforeQueries()
The query automatic flush configuration.
|
Object |
getHint(String name)
Get the hint value for the specific key as originally set by the caller, or null if the hint is not specified.
|
Map<String,Object> |
getHints()
Gets the current hints set on this receiver.
|
int |
getLockScope()
The lock scope for next fetch.
|
int |
getLockTimeout()
The number of milliseconds to wait for an object lock, or -1 for no
limit.
|
int |
getMaxFetchDepth()
Return the maximum depth of fetched instance graph.
|
boolean |
getQueryCacheEnabled()
Return whether or not query caching is enabled.
|
int |
getQueryTimeout()
The number of milliseconds to wait for a query, or -1 for no
limit.
|
int |
getReadLockLevel()
The lock level to use for locking loaded objects.
|
Set<Class<?>> |
getRootClasses()
Root classes for recursive operations.
|
Set<Object> |
getRootInstances()
Root instances for recursive operations.
|
Collection<String> |
getSupportedHints() |
int |
getWriteLockLevel()
The lock level to use for locking dirtied objects.
|
boolean |
hasFetchGroup(String group)
Return true if the given fetch group has been added.
|
boolean |
hasFetchGroupAll() |
boolean |
hasFetchGroupDefault() |
boolean |
hasField(String field)
Return true if the given fully-qualified field has been added.
|
boolean |
isDefaultPUFetchGroupConfigurationOnly()
Affirm if the Fetch Plan currently matches the Persistence Unit's configured default.
|
boolean |
isFetchConfigurationSQLCacheAdmissible()
Whether SQL generated by the FetchConfiguration's current configuration should be cached.
|
boolean |
isHintSet(String key)
Affirms if the given key is set as a hint.
|
void |
lock()
Synchronize on internal lock if multithreaded is true.
|
protected FetchConfigurationImpl |
newInstance(FetchConfigurationImpl.ConfigurationState state)
Return a new hollow instance.
|
ResultList<?> |
newResultList(ResultObjectProvider rop)
Return a new result list for the current fetch configuration.
|
protected static void |
populateHintSetter(Class<?> target,
String hint,
Class<?> type,
String... prefixes)
Populate static registry of hints.
|
protected static void |
populateHintSetter(Class<?> target,
String method,
String hint,
Class<?> type,
String... prefixes)
Populate static registry of hints.
|
FetchConfiguration |
removeFetchGroup(String group)
Remove the given fetch group.
|
FetchConfiguration |
removeFetchGroups(Collection<String> groups)
Removes
groups from the set of fetch group names
to use when loading objects. |
FetchConfiguration |
removeField(String field)
Remove the given fully-qualified field.
|
FetchConfiguration |
removeFields(Collection<String> fields)
Removes
fields from the set of fully-qualified field names
to use when loading objects. |
void |
removeHint(String... keys)
Removes the given keys and their hint value.
|
Object |
removeHint(String name) |
int |
requiresFetch(FieldMetaData fm)
Affirms if the given field requires to be fetched in the context
of current fetch operation.
|
boolean |
requiresLoad()
Return false if we know that the object being fetched with this
configuration does not require a load, because this configuration came
from a traversal of a
FetchConfiguration.FETCH_REF field. |
FetchConfiguration |
resetFetchGroups()
Resets the set of fetch groups to the list in the global configuration.
|
void |
setCacheRetrieveMode(DataCacheRetrieveMode mode)
Sets the current retrieve mode for data cache.
|
void |
setCacheStoreMode(DataCacheStoreMode mode)
Sets the current storage mode for data cache.
|
void |
setContext(StoreContext ctx)
Called automatically by the system to associate the fetch configuration
with a context before use.
|
FetchConfiguration |
setExtendedPathLookup(boolean flag)
Sets extended path lookup feature.
|
FetchConfiguration |
setFetchBatchSize(int fetchBatchSize)
Set the fetch batch size for large result set support.
|
FetchConfiguration |
setFlushBeforeQueries(int flush)
The query automatic flush configuration.
|
void |
setHint(String key,
Object value)
Same as
setHint(key, value, value). |
void |
setHint(String key,
Object value,
Object original)
Sets the hint to the given value.
|
FetchConfiguration |
setLockScope(int scope)
The lock scope for next fetch.
|
FetchConfiguration |
setLockTimeout(int timeout)
The number of milliseconds to wait for an object lock, or -1 for no
limit.
|
FetchConfiguration |
setMaxFetchDepth(int depth)
Set the maximum depth of the fetched instance graph.
|
FetchConfiguration |
setQueryCacheEnabled(boolean cache)
Control whether or not query caching is enabled.
|
FetchConfiguration |
setQueryTimeout(int timeout)
The number of milliseconds to wait for a query, or -1 for no
limit.
|
FetchConfiguration |
setReadLockLevel(int level)
The lock level to use for locking loaded objects.
|
FetchConfiguration |
setRootClasses(Collection<Class<?>> classes)
Root classes for recursive operations.
|
FetchConfiguration |
setRootInstances(Collection<?> instances)
Root instances for recursive operations.
|
FetchConfiguration |
setWriteLockLevel(int level)
The lock level to use for locking dirtied objects.
|
String |
toString() |
protected String |
toString(Object o) |
FetchConfiguration |
traverse(FieldMetaData fm)
Traverse the given field to generate (possibly) a new configuration
state.
|
void |
unlock()
Release internal lock if multithreaded is true.
|
public FetchConfigurationImpl()
protected FetchConfigurationImpl(FetchConfigurationImpl.ConfigurationState state)
protected static void populateHintSetter(Class<?> target, String hint, Class<?> type, String... prefixes)
target - The name of the target class that will receive this hint.hint - the simple name of the hint without a prefix.type - the value argument type of the target setter method.prefixes - the prefixes will be added to the simple hint name.protected static void populateHintSetter(Class<?> target, String method, String hint, Class<?> type, String... prefixes)
target - The name of the target class that will receive this hint.method - The name of the method in the target class that will receive this hint.hint - the simple name of the hint without a prefix.type - the value argument type of the target setter method.prefixes - the prefixes will be added to the simple hint name.public StoreContext getContext()
FetchConfigurationgetContext in interface FetchConfigurationpublic void setContext(StoreContext ctx)
FetchConfigurationsetContext in interface FetchConfigurationpublic Object clone()
clone in interface FetchConfigurationclone in class Objectprotected FetchConfigurationImpl newInstance(FetchConfigurationImpl.ConfigurationState state)
public void copy(FetchConfiguration fetch)
FetchConfigurationcopy in interface FetchConfigurationpublic int getFetchBatchSize()
FetchConfigurationopenjpa.FetchBatchSize setting. Note
that this property will be ignored under some data stores.getFetchBatchSize in interface FetchConfigurationpublic FetchConfiguration setFetchBatchSize(int fetchBatchSize)
FetchConfigurationopenjpa.FetchBatchSize setting. Note
that this property will be ignored under some data stores.setFetchBatchSize in interface FetchConfigurationpublic int getMaxFetchDepth()
FetchConfiguration1getMaxFetchDepth in interface FetchConfigurationpublic FetchConfiguration setMaxFetchDepth(int depth)
FetchConfigurationsetMaxFetchDepth in interface FetchConfigurationdepth - denotes limiting length of traversal path from a root
instance. -1 implies no limit. 0 is not
permissible.public boolean getQueryCacheEnabled()
FetchConfigurationtrue but the datacache plugin is not installed, caching
will not be enabled. If this
returns false, query caching will not be used
even if the datacache plugin is installed.getQueryCacheEnabled in interface FetchConfigurationpublic FetchConfiguration setQueryCacheEnabled(boolean cache)
FetchConfigurationsetQueryCacheEnabled in interface FetchConfigurationpublic int getFlushBeforeQueries()
FetchConfigurationgetFlushBeforeQueries in interface FetchConfigurationpublic boolean getExtendedPathLookup()
FetchConfigurationgetExtendedPathLookup in interface FetchConfigurationpublic FetchConfiguration setExtendedPathLookup(boolean flag)
FetchConfigurationsetExtendedPathLookup in interface FetchConfigurationpublic FetchConfiguration setFlushBeforeQueries(int flush)
FetchConfigurationsetFlushBeforeQueries in interface FetchConfigurationpublic Set<String> getFetchGroups()
FetchConfigurationopenjpa.FetchGroups setting. This set is not thread safe.getFetchGroups in interface FetchConfigurationpublic boolean hasFetchGroup(String group)
FetchConfigurationhasFetchGroup in interface FetchConfigurationpublic boolean hasFetchGroupDefault()
public boolean hasFetchGroupAll()
public FetchConfiguration addFetchGroup(String name)
FetchConfigurationgroup to the set of fetch group names to
use when loading objects.addFetchGroup in interface FetchConfigurationpublic FetchConfiguration addFetchGroups(Collection<String> groups)
FetchConfigurationgroups to the set of fetch group names to
use when loading objects.addFetchGroups in interface FetchConfigurationpublic FetchConfiguration removeFetchGroup(String group)
FetchConfigurationremoveFetchGroup in interface FetchConfigurationpublic FetchConfiguration removeFetchGroups(Collection<String> groups)
FetchConfigurationgroups from the set of fetch group names
to use when loading objects.removeFetchGroups in interface FetchConfigurationpublic FetchConfiguration clearFetchGroups()
FetchConfigurationclearFetchGroups in interface FetchConfigurationpublic FetchConfiguration resetFetchGroups()
FetchConfigurationresetFetchGroups in interface FetchConfigurationpublic boolean isDefaultPUFetchGroupConfigurationOnly()
FetchConfigurationisDefaultPUFetchGroupConfigurationOnly in interface FetchConfigurationpublic boolean isFetchConfigurationSQLCacheAdmissible()
FetchConfigurationisFetchConfigurationSQLCacheAdmissible in interface FetchConfigurationpublic Set<String> getFields()
FetchConfigurationgetFields in interface FetchConfigurationpublic boolean hasField(String field)
FetchConfigurationhasField in interface FetchConfigurationpublic FetchConfiguration addField(String field)
FetchConfigurationfield to the set of fully-qualified field names to
use when loading objects.addField in interface FetchConfigurationpublic FetchConfiguration addFields(Collection<String> fields)
FetchConfigurationfields to the set of fully-qualified field names to
use when loading objects.addFields in interface FetchConfigurationpublic FetchConfiguration removeField(String field)
FetchConfigurationremoveField in interface FetchConfigurationpublic FetchConfiguration removeFields(Collection<String> fields)
FetchConfigurationfields from the set of fully-qualified field names
to use when loading objects.removeFields in interface FetchConfigurationpublic FetchConfiguration clearFields()
FetchConfigurationclearFields in interface FetchConfigurationpublic DataCacheRetrieveMode getCacheRetrieveMode()
FetchConfigurationgetCacheRetrieveMode in interface FetchConfigurationpublic DataCacheStoreMode getCacheStoreMode()
FetchConfigurationgetCacheStoreMode in interface FetchConfigurationpublic void setCacheRetrieveMode(DataCacheRetrieveMode mode)
FetchConfigurationsetCacheRetrieveMode in interface FetchConfigurationpublic void setCacheStoreMode(DataCacheStoreMode mode)
FetchConfigurationsetCacheStoreMode in interface FetchConfigurationpublic int getLockTimeout()
FetchConfigurationgetLockTimeout in interface FetchConfigurationpublic FetchConfiguration setLockTimeout(int timeout)
FetchConfigurationsetLockTimeout in interface FetchConfigurationpublic int getQueryTimeout()
FetchConfigurationgetQueryTimeout in interface FetchConfigurationpublic FetchConfiguration setQueryTimeout(int timeout)
FetchConfigurationsetQueryTimeout in interface FetchConfigurationpublic int getLockScope()
FetchConfigurationgetLockScope in interface FetchConfigurationpublic FetchConfiguration setLockScope(int scope)
FetchConfigurationsetLockScope in interface FetchConfigurationpublic int getReadLockLevel()
FetchConfigurationgetReadLockLevel in interface FetchConfigurationpublic FetchConfiguration setReadLockLevel(int level)
FetchConfigurationsetReadLockLevel in interface FetchConfigurationpublic int getWriteLockLevel()
FetchConfigurationgetWriteLockLevel in interface FetchConfigurationpublic FetchConfiguration setWriteLockLevel(int level)
FetchConfigurationsetWriteLockLevel in interface FetchConfigurationpublic ResultList<?> newResultList(ResultObjectProvider rop)
FetchConfigurationnewResultList in interface FetchConfigurationpublic Map<String,Object> getHints()
getHints in interface FetchConfigurationpublic boolean isHintSet(String key)
isHintSet in interface FetchConfigurationpublic void removeHint(String... keys)
public Collection<String> getSupportedHints()
public void setHint(String key, Object value)
setHint(key, value, value).setHint in interface FetchConfigurationvalue - the value of the hint. If the hint has a corresponding setter, then
the type of value must be same as the setter argument.setHint(String, Object, Object)public void setHint(String key, Object value, Object original)
setHint in interface FetchConfigurationkey - a hint key. If it is one of the statically registered hint key then the setter is called.value - to be set. The given value type must match the argument type of the setter, if one exists.original - value as specified by the caller. This value is put in the hints map.IllegalArgumentException - if the given value is not acceptable by the setter method, if one
exists corresponds the given hint key.public Object getHint(String name)
FetchConfigurationgetHint in interface FetchConfigurationpublic Set<Class<?>> getRootClasses()
FetchConfigurationgetRootClasses in interface FetchConfigurationpublic FetchConfiguration setRootClasses(Collection<Class<?>> classes)
FetchConfigurationsetRootClasses in interface FetchConfigurationpublic Set<Object> getRootInstances()
FetchConfigurationgetRootInstances in interface FetchConfigurationpublic FetchConfiguration setRootInstances(Collection<?> instances)
FetchConfigurationsetRootInstances in interface FetchConfigurationpublic void lock()
FetchConfigurationlock in interface FetchConfigurationpublic void unlock()
FetchConfigurationunlock in interface FetchConfigurationpublic int requiresFetch(FieldMetaData fm)
FetchConfigurationFetchConfiguration.FETCH_NONE,
FetchConfiguration.FETCH_LOAD, FETCH_REF.requiresFetch in interface FetchConfigurationpublic boolean requiresLoad()
FetchConfigurationFetchConfiguration.FETCH_REF field.requiresLoad in interface FetchConfigurationpublic FetchConfiguration traverse(FieldMetaData fm)
FetchConfigurationtraverse in interface FetchConfigurationCopyright © 2006–2020 Apache Software Foundation. All rights reserved.