Package cz.cvut.kbss.jopa.proxy.lazy
Interface LazyLoadingProxy<T>
- Type Parameters:
T
- Type of the loaded value
- All Known Subinterfaces:
LazyLoadingEntityProxy<T>
- All Known Implementing Classes:
LazyLoadingListProxy
,LazyLoadingMapProxy
,LazyLoadingSetProxy
public interface LazyLoadingProxy<T>
Marker interface for lazy loading proxy implementations.
-
Method Summary
Modifier and TypeMethodDescriptionIf this proxy has already been loaded, this method returns the loaded value.boolean
isLoaded()
Checks whether this proxy has already been loaded.Triggers value loading.default T
unwrap()
Gets a value that should be used to replace this proxy outside a persistence context.
-
Method Details
-
triggerLazyLoading
T triggerLazyLoading()Triggers value loading.- Returns:
- Loaded value
-
isLoaded
boolean isLoaded()Checks whether this proxy has already been loaded.- Returns:
true
if this proxy has been loaded,false
otherwise
-
getLoadedValue
T getLoadedValue()If this proxy has already been loaded, this method returns the loaded value.- Returns:
- The loaded value,
null
if this proxy has not been loaded, yet - Throws:
IllegalStateException
- If called before this proxy is loaded- See Also:
-
unwrap
Gets a value that should be used to replace this proxy outside a persistence context.- Returns:
- Default value to replace this proxy with
-