T - the supported type for storingpublic interface Storage<T>
Storage allows load and save
operations on objects. The mode of achieving this such as where the states
are stored, null-safety, stored format and others will depend on the
implementation.| Modifier and Type | Method and Description |
|---|---|
T |
load()
Loads the stored state as a new object.
|
default java.util.concurrent.CompletableFuture<? extends T> |
loadAsync()
Loads the stored state asynchronously.
|
void |
save(T obj)
Stores the state of a given object.
|
default java.util.concurrent.CompletableFuture<java.lang.Void> |
saveAsync(T obj)
Stores the state of a given object asynchronously.
|
T load() throws java.lang.Exception
java.lang.Exception - thrown when an implementation encountered a
checked exception; the actual type may depend on
the implementationjava.lang.NullPointerException - thrown when an implementation does not recognize
null as a valid destination; usually it
isn'tdefault java.util.concurrent.CompletableFuture<? extends T> loadAsync()
load()void save(T obj) throws java.lang.Exception
obj - the object to store the state ofjava.lang.Exception - thrown when an implementation encountered a
checked exception; the actual type may depend on
the implementationjava.lang.NullPointerException - thrown when an implementation does not recognize
null as a valid state to storedefault java.util.concurrent.CompletableFuture<java.lang.Void> saveAsync(T obj)
obj - the object to store the state ofsave(Object)