T - The type of the held value.public class Holder<T extends Expirable>
extends java.lang.Object
| Constructor and Description |
|---|
Holder(IoSupplier<T> supplier) |
Holder(IoSupplier<T> supplier,
java.lang.Object lock) |
| Modifier and Type | Method and Description |
|---|---|
T |
getCached()
Returns the currently cached value.
|
T |
getUpToDate()
Returns the up-to-date value, refreshing it if necessary.
|
java.util.concurrent.CompletableFuture<T> |
getUpToDateAsync()
Returns the up-to-date value, refreshing it if necessary.
|
T |
getUpToDateUnchecked()
Returns the up-to-date value, refreshing it if necessary.
|
boolean |
hasValue()
Checks if the holder currently has a non-null value.
|
T |
refresh()
Forces a refresh of the value, regardless of its current state.
|
java.util.concurrent.CompletableFuture<T> |
refreshAsync()
Forces a refresh of the value, regardless of its current state.
|
boolean |
refreshIfExpired()
Refreshes the value if it is null or expired.
|
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
refreshIfExpiredAsync()
Refreshes the value if it is null or expired.
|
boolean |
refreshIfExpiredUnchecked()
Refreshes the value if it is null or expired.
|
T |
refreshUnchecked()
Forces a refresh of the value, regardless of its current state.
|
void |
set(T value) |
public Holder(IoSupplier<T> supplier)
public Holder(IoSupplier<T> supplier, java.lang.Object lock)
public T getCached()
public T getUpToDate() throws java.io.IOException
java.io.IOExceptionpublic T getUpToDateUnchecked()
public java.util.concurrent.CompletableFuture<T> getUpToDateAsync()
public boolean hasValue()
public boolean refreshIfExpired()
throws java.io.IOException
java.io.IOExceptionpublic boolean refreshIfExpiredUnchecked()
public java.util.concurrent.CompletableFuture<java.lang.Boolean> refreshIfExpiredAsync()
public T refresh() throws java.io.IOException
java.io.IOExceptionpublic T refreshUnchecked()
public java.util.concurrent.CompletableFuture<T> refreshAsync()
@ApiStatus.Internal public void set(T value)