Package cz.cvut.kbss.jopa.proxy.lazy
Class LazyLoadingSetProxy<O,E>
java.lang.Object
cz.cvut.kbss.jopa.proxy.lazy.LazyLoadingSetProxy<O,E>
- All Implemented Interfaces:
LazyLoadingProxy<Set<E>>
,Iterable<E>
,Collection<E>
,Set<E>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FieldSpecification<? super O,
Set<E>> protected final O
protected final UnitOfWork
-
Constructor Summary
ConstructorsConstructorDescriptionLazyLoadingSetProxy
(O owner, FieldSpecification<? super O, Set<E>> fieldSpec, UnitOfWork persistenceContext) -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(Collection<? extends E> c) void
clear()
boolean
boolean
containsAll
(Collection<?> c) If this proxy has already been loaded, this method returns the loaded value.boolean
isEmpty()
boolean
isLoaded()
Checks whether this proxy has already been loaded.iterator()
boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) int
size()
Object[]
toArray()
<ET> ET[]
toArray
(ET[] a) toString()
Triggers value loading.unwrap()
Gets a value that should be used to replace this proxy outside a persistence context.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Field Details
-
owner
-
fieldSpec
-
persistenceContext
-
-
Constructor Details
-
LazyLoadingSetProxy
public LazyLoadingSetProxy(O owner, FieldSpecification<? super O, Set<E>> fieldSpec, UnitOfWork persistenceContext)
-
-
Method Details
-
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 interfaceLazyLoadingProxy<O>
- Returns:
- Default value to replace this proxy with
-
triggerLazyLoading
Description copied from interface:LazyLoadingProxy
Triggers value loading.- Specified by:
triggerLazyLoading
in interfaceLazyLoadingProxy<O>
- Returns:
- Loaded value
-
isLoaded
public boolean isLoaded()Description copied from interface:LazyLoadingProxy
Checks whether this proxy has already been loaded.- Specified by:
isLoaded
in interfaceLazyLoadingProxy<O>
- Returns:
true
if this proxy has been loaded,false
otherwise
-
getLoadedValue
Description copied from interface:LazyLoadingProxy
If this proxy has already been loaded, this method returns the loaded value.- Specified by:
getLoadedValue
in interfaceLazyLoadingProxy<O>
- Returns:
- The loaded value,
null
if this proxy has not been loaded, yet - See Also:
-
size
public int size()- Specified by:
size
in interfaceCollection<O>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<O>
-
contains
- Specified by:
contains
in interfaceCollection<O>
-
iterator
- Specified by:
iterator
in interfaceCollection<O>
- Specified by:
iterator
in interfaceIterable<O>
-
toArray
- Specified by:
toArray
in interfaceCollection<O>
-
toArray
public <ET> ET[] toArray(ET[] a) - Specified by:
toArray
in interfaceCollection<O>
-
add
- Specified by:
add
in interfaceCollection<O>
-
remove
- Specified by:
remove
in interfaceCollection<O>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<O>
-
addAll
- Specified by:
addAll
in interfaceCollection<O>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<O>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<O>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<O>
-
toString
-