Skip to contentPackage: LazyLoadingProxy
LazyLoadingProxy
name | instruction | branch | complexity | line | method |
---|
unwrap() |
|
|
|
|
|
Coverage
1: package cz.cvut.kbss.jopa.proxy.lazy;
2:
3: /**
4: * Marker interface for lazy loading proxy implementations.
5: *
6: * @param <T> Type of the loaded value
7: */
8: public interface LazyLoadingProxy<T> {
9:
10: /**
11: * Triggers value loading.
12: *
13: * @return Loaded value
14: */
15: T triggerLazyLoading();
16:
17: /**
18: * Checks whether this proxy has already been loaded.
19: *
20: * @return {@code true} if this proxy has been loaded, {@code false} otherwise
21: */
22: boolean isLoaded();
23:
24: /**
25: * If this proxy has already been loaded, this method returns the loaded value.
26: *
27: * @return The loaded value, {@code null} if this proxy has not been loaded, yet
28: * @see #isLoaded()
29: * @throws IllegalStateException If called before this proxy is loaded
30: */
31: T getLoadedValue();
32:
33: /**
34: * Gets a value that should be used to replace this proxy outside a persistence context.
35: *
36: * @return Default value to replace this proxy with
37: */
38: default T unwrap() {
39: return null;
40: }
41: }