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 proxy
K - Map key type
V - 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.
  • Field Details

    • owner

      protected final T owner
    • fieldSpec

      protected final FieldSpecification<? super T,Map<K,V>> fieldSpec
    • persistenceContext

      protected final UnitOfWork persistenceContext
  • Constructor Details

  • Method Details

    • triggerLazyLoading

      public Map<K,V> triggerLazyLoading()
      Description copied from interface: LazyLoadingProxy
      Triggers value loading.
      Specified by:
      triggerLazyLoading in interface LazyLoadingProxy<T>
      Returns:
      Loaded value
    • isLoaded

      public boolean isLoaded()
      Description copied from interface: LazyLoadingProxy
      Checks whether this proxy has already been loaded.
      Specified by:
      isLoaded in interface LazyLoadingProxy<T>
      Returns:
      true if this proxy has been loaded, false otherwise
    • getLoadedValue

      public Map<K,V> getLoadedValue()
      Description copied from interface: LazyLoadingProxy
      If this proxy has already been loaded, this method returns the loaded value.
      Specified by:
      getLoadedValue in interface LazyLoadingProxy<T>
      Returns:
      The loaded value, null if this proxy has not been loaded, yet
      See Also:
    • unwrap

      public Map<K,V> unwrap()
      Description copied from interface: LazyLoadingProxy
      Gets a value that should be used to replace this proxy outside a persistence context.
      Specified by:
      unwrap in interface LazyLoadingProxy<T>
      Returns:
      Default value to replace this proxy with
    • size

      public int size()
      Specified by:
      size in interface Map<T,K>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<T,K>
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map<T,K>
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map<T,K>
    • get

      public V get(Object key)
      Specified by:
      get in interface Map<T,K>
    • put

      public V put(K key, V value)
      Specified by:
      put in interface Map<T,K>
    • remove

      public V remove(Object key)
      Specified by:
      remove in interface Map<T,K>
    • putAll

      public void putAll(Map<? extends K,? extends V> m)
      Specified by:
      putAll in interface Map<T,K>
    • clear

      public void clear()
      Specified by:
      clear in interface Map<T,K>
    • keySet

      public Set<K> keySet()
      Specified by:
      keySet in interface Map<T,K>
    • values

      public Collection<V> values()
      Specified by:
      values in interface Map<T,K>
    • entrySet

      public Set<Map.Entry<K,V>> entrySet()
      Specified by:
      entrySet in interface Map<T,K>
    • toString

      public String toString()
      Overrides:
      toString in class Object