Package com.clickhouse.data
Class ClickHouseDeferredValue<T>
java.lang.Object
com.clickhouse.data.ClickHouseDeferredValue<T>
- All Implemented Interfaces:
Supplier<T>
This class represents a deferred value. It holds a reference to a
Supplier or Future to retrieve value only when get()
or getOptional() was called.-
Method Summary
Modifier and TypeMethodDescriptionget()Gets optional value, which may or may not be null.static <T> ClickHouseDeferredValue<T>of(CompletableFuture<T> future) Wraps a future object.static <T> ClickHouseDeferredValue<T>of(CompletableFuture<T> future, long timeout) Wraps a future object.static <T> ClickHouseDeferredValue<T>Wraps return value from a supplier function.static <T> ClickHouseDeferredValue<T>Wraps given value as a deferred value.
-
Method Details
-
of
Wraps a future object.- Type Parameters:
T- type of the value- Parameters:
future- future object, could be null- Returns:
- deferred value of a future object
-
of
Wraps a future object.- Type Parameters:
T- type of the value- Parameters:
future- future object, could be nulltimeout- timeout in milliseconds, zero or negative number means no timeout- Returns:
- deferred vaue of a future object
-
of
Wraps return value from a supplier function.- Type Parameters:
T- type of the value- Parameters:
supplier- supplier function, could be null- Returns:
- deferred value of return value from supplier function
-
of
Wraps given value as a deferred value.- Type Parameters:
T- type of the value- Parameters:
value- value to wrapclazz- class of the value- Returns:
- deferred value
-
get
-
getOptional
Gets optional value, which may or may not be null.- Returns:
- optional value
-