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 Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.springframework.core.convert.converter.Converter
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    FutureResult(T resultHolder)
    Create new FutureResult for given object actually holding the result itself.
    FutureResult(T resultHolder, org.springframework.core.convert.converter.Converter converter)
    Create new FutureResult for given object actually holding the result itself and a converter capable of transforming the result via convert(Object).
    FutureResult(T resultHolder, org.springframework.core.convert.converter.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).
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
    Indicate whether or not the actual result needs to be converted before handing over.
    convert(Object result)
    Converts the given result if a converter is specified, else returns the result
    abstract Object
    get()
     
    org.springframework.core.convert.converter.Converter
     
    Get the object holding the actual result.
    boolean
    Indicates if this result is the status of an operation.
    void
    setStatus(boolean status)
    Indicates if this result is the status of an operation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • converter

      protected org.springframework.core.convert.converter.Converter converter
  • 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 org.springframework.core.convert.converter.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 org.springframework.core.convert.converter.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 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

      @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