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 the Future or response wrapper).

public abstract class FutureResult<T> extends Object
The result of an asynchronous operation
Author:
Jennifer Hickey, Christoph Strobl, Mark Paluch
  • Field Details

  • Constructor Details

    • FutureResult

      public FutureResult(T resultHolder)
      Create new FutureResult for given object actually holding the result itself.
      Parameters:
      resultHolder - must not be null.
    • FutureResult

      public FutureResult(T resultHolder, @Nullable Converter converter)
      Create new FutureResult for given object actually holding the result itself and a converter capable of transforming the result via convert(Object).
      Parameters:
      resultHolder - must not be null.
      converter - can be null and will be defaulted to an identity converter value -> value to preserve the original value.
    • FutureResult

      public FutureResult(T resultHolder, @Nullable Converter converter, Supplier<?> defaultConversionResult)
      Create new FutureResult for given object actually holding the result itself and a converter capable of transforming the result via convert(Object).
      Parameters:
      resultHolder - must not be null.
      converter - can be null and will be defaulted to an identity converter value -> value to preserve the original value.
      defaultConversionResult - must not be null.
      Since:
      2.1
  • Method Details

    • getResultHolder

      public T getResultHolder()
      Get the object holding the actual result.
      Returns:
      never null.
      Since:
      1.1
    • convert

      @Nullable public Object convert(@Nullable Object result)
      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 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

      @Nullable public abstract Object get()
      Returns:
      The result of the operation. Can be null.
    • conversionRequired

      public abstract boolean conversionRequired()
      Indicate whether or not the actual result needs to be converted before handing over.
      Returns:
      true if result conversion is required.
      Since:
      2.1