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 theFutureor response wrapper).
The result of an asynchronous operation
- Author:
- Jennifer Hickey, Christoph Strobl, Mark Paluch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.core.convert.converter.Converter -
Constructor Summary
ConstructorsConstructorDescriptionFutureResult(T resultHolder) Create newFutureResultfor given object actually holding the result itself.FutureResult(T resultHolder, org.springframework.core.convert.converter.Converter converter) Create newFutureResultfor given object actually holding the result itself and a converter capable of transforming the result viaconvert(Object).FutureResult(T resultHolder, org.springframework.core.convert.converter.Converter converter, Supplier<?> defaultConversionResult) Create newFutureResultfor given object actually holding the result itself and a converter capable of transforming the result viaconvert(Object). -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanIndicate whether or not the actual result needs to beconvertedbefore handing over.Converts the given result if a converter is specified, else returns the resultabstract Objectget()org.springframework.core.convert.converter.ConverterGet the object holding the actual result.booleanisStatus()Indicates if this result is the status of an operation.voidsetStatus(boolean status) Indicates if this result is the status of an operation.
-
Field Details
-
converter
protected org.springframework.core.convert.converter.Converter converter
-
-
Constructor Details
-
FutureResult
Create newFutureResultfor given object actually holding the result itself.- Parameters:
resultHolder- must not be null.
-
FutureResult
public FutureResult(T resultHolder, @Nullable org.springframework.core.convert.converter.Converter converter) Create newFutureResultfor 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 -> valueto preserve the original value.
-
FutureResult
public FutureResult(T resultHolder, @Nullable org.springframework.core.convert.converter.Converter converter, Supplier<?> defaultConversionResult) Create newFutureResultfor 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 -> valueto 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
public org.springframework.core.convert.converter.Converter 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 beconvertedbefore handing over.- Returns:
- true if result conversion is required.
- Since:
- 2.1
-