Class FutureResult<T>
java.lang.Object
org.springframework.data.redis.connection.FutureResult<T>
- Type Parameters:
T
- The data type of the object that holds the future result (usually type of theFuture
or response wrapper).
The result of an asynchronous operation
- Author:
- Jennifer Hickey, Christoph Strobl, Mark Paluch
-
Field Summary
-
Constructor Summary
ConstructorDescriptionFutureResult
(T resultHolder) Create newFutureResult
for given object actually holding the result itself.FutureResult
(T resultHolder, Converter converter) Create newFutureResult
for given object actually holding the result itself and a converter capable of transforming the result viaconvert(Object)
.FutureResult
(T resultHolder, Converter converter, Supplier<?> defaultConversionResult) Create newFutureResult
for given object actually holding the result itself and a converter capable of transforming the result viaconvert(Object)
. -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
Indicate whether or not the actual result needs to beconverted
before handing over.Converts the given result if a converter is specified, else returns the resultabstract Object
get()
Get the object holding the actual result.boolean
isStatus()
Indicates if this result is the status of an operation.void
setStatus
(boolean status) Indicates if this result is the status of an operation.
-
Field Details
-
converter
-
-
Constructor Details
-
FutureResult
Create newFutureResult
for given object actually holding the result itself.- Parameters:
resultHolder
- must not be null.
-
FutureResult
Create newFutureResult
for given object actually holding the result itself and a converter capable of transforming the result viaconvert(Object)
.- Parameters:
resultHolder
- must not be null.converter
- can be null and will be defaulted to an identity convertervalue -> value
to preserve the original value.
-
FutureResult
public FutureResult(T resultHolder, @Nullable Converter converter, Supplier<?> defaultConversionResult) Create newFutureResult
for given object actually holding the result itself and a converter capable of transforming the result viaconvert(Object)
.- Parameters:
resultHolder
- must not be null.converter
- can be null and will be defaulted to an identity convertervalue -> value
to preserve the original value.defaultConversionResult
- must not be null.- Since:
- 2.1
-
-
Method Details
-
getResultHolder
Get the object holding the actual result.- Returns:
- never null.
- Since:
- 1.1
-
convert
Converts the given result if a converter is specified, else returns the result- Parameters:
result
- The result to convert. Can be null.- Returns:
- The converted result or null.
-
getConverter
-
isStatus
public boolean isStatus()Indicates if this result is the status of an operation. Typically status results will be discarded on conversion.- Returns:
- true if this is a status result (i.e. OK)
-
setStatus
public void setStatus(boolean status) Indicates if this result is the status of an operation. Typically status results will be discarded on conversion. -
get
- Returns:
- The result of the operation. Can be null.
-
conversionRequired
public abstract boolean conversionRequired()Indicate whether or not the actual result needs to beconverted
before handing over.- Returns:
- true if result conversion is required.
- Since:
- 2.1
-