Package cz.cvut.kbss.jopa.proxy.lazy
Class LazyLoadingMapProxy<T,K,V>
java.lang.Object
cz.cvut.kbss.jopa.proxy.lazy.LazyLoadingMapProxy<T,K,V>
- Type Parameters:
T- Type of the object whose attribute value is this map proxyK- Map key typeV- Map value type
- All Implemented Interfaces:
LazyLoadingProxy<Map<K,,V>> Map<K,V>
public class LazyLoadingMapProxy<T,K,V>
extends Object
implements LazyLoadingProxy<Map<K,V>>, Map<K,V>
Map proxy that triggers lazy loading when its contents is accessed.-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FieldSpecification<? super T,Map<K, V>> protected final Tprotected final UnitOfWork -
Constructor Summary
ConstructorsConstructorDescriptionLazyLoadingMapProxy(T owner, FieldSpecification<? super T, Map<K, V>> fieldSpec, UnitOfWork persistenceContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()If this proxy has already been loaded, this method returns the loaded value.booleanisEmpty()booleanisLoaded()Checks whether this proxy has already been loaded.keySet()voidintsize()toString()Triggers value loading.unwrap()Gets a value that should be used to replace this proxy outside a persistence context.values()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
owner
-
fieldSpec
-
persistenceContext
-
-
Constructor Details
-
LazyLoadingMapProxy
public LazyLoadingMapProxy(T owner, FieldSpecification<? super T, Map<K, V>> fieldSpec, UnitOfWork persistenceContext)
-
-
Method Details
-
triggerLazyLoading
Description copied from interface:LazyLoadingProxyTriggers value loading.- Specified by:
triggerLazyLoadingin interfaceLazyLoadingProxy<T>- Returns:
- Loaded value
-
isLoaded
public boolean isLoaded()Description copied from interface:LazyLoadingProxyChecks whether this proxy has already been loaded.- Specified by:
isLoadedin interfaceLazyLoadingProxy<T>- Returns:
trueif this proxy has been loaded,falseotherwise
-
getLoadedValue
Description copied from interface:LazyLoadingProxyIf this proxy has already been loaded, this method returns the loaded value.- Specified by:
getLoadedValuein interfaceLazyLoadingProxy<T>- Returns:
- The loaded value,
nullif this proxy has not been loaded, yet - See Also:
-
unwrap
Description copied from interface:LazyLoadingProxyGets a value that should be used to replace this proxy outside a persistence context.- Specified by:
unwrapin interfaceLazyLoadingProxy<T>- Returns:
- Default value to replace this proxy with
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<T,K>
-
containsValue
- Specified by:
containsValuein interfaceMap<T,K>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
toString
-