Class PromisedValuesImpl<T>

java.lang.Object
org.dataloader.impl.PromisedValuesImpl<T>
All Implemented Interfaces:
PromisedValues<T>

public class PromisedValuesImpl<T> extends Object implements PromisedValues<T>
  • Method Details

    • combineAllOf

      public static <T> PromisedValues<T> combineAllOf(List<? extends CompletionStage<T>> cfs)
    • combinePromisedValues

      public static <T> PromisedValues<T> combinePromisedValues(List<PromisedValues<T>> promisedValues)
    • thenAccept

      public PromisedValues<T> thenAccept(Consumer<PromisedValues<T>> handler)
      Description copied from interface: PromisedValues
      When the all the futures complete, this call back will be invoked with this PromisedValues as a parameter
      Specified by:
      thenAccept in interface PromisedValues<T>
      Parameters:
      handler - the call back which will be given this object
      Returns:
      a new PromisedValues which you can compose more computations with
    • succeeded

      public boolean succeeded()
      Specified by:
      succeeded in interface PromisedValues<T>
      Returns:
      true if all the futures completed successfully
    • failed

      public boolean failed()
      Specified by:
      failed in interface PromisedValues<T>
      Returns:
      true if any of the futures completed unsuccessfully
    • isDone

      public boolean isDone()
      Description copied from interface: PromisedValues
      The true if the all the futures have completed (and hence this PromisedValues has completed)
      Specified by:
      isDone in interface PromisedValues<T>
      Returns:
      true if all the futures have completed
    • cause

      public Throwable cause()
      Description copied from interface: PromisedValues
      The exception cause or null if it didn't fail
      Specified by:
      cause in interface PromisedValues<T>
      Returns:
      an exception or null if the future did not fail
    • succeeded

      public boolean succeeded(int index)
      Description copied from interface: PromisedValues
      The true if the CompletionStage at the specified index succeeded
      Specified by:
      succeeded in interface PromisedValues<T>
      Parameters:
      index - the index of the CompletionStage
      Returns:
      true if the future at the specified index succeeded
    • cause

      public Throwable cause(int index)
      Description copied from interface: PromisedValues
      The exception cause at the specified index or null if it didn't fail
      Specified by:
      cause in interface PromisedValues<T>
      Parameters:
      index - the index of the CompletionStage
      Returns:
      an exception or null if the future did not fail
    • get

      public T get(int index)
      Description copied from interface: PromisedValues
      The value at index or null if it failed
      Specified by:
      get in interface PromisedValues<T>
      Parameters:
      index - the index of the future
      Returns:
      the value of the future
    • toList

      public List<T> toList()
      Description copied from interface: PromisedValues
      Returns the underlying values as a list
      Specified by:
      toList in interface PromisedValues<T>
      Returns:
      the list of underlying values
    • size

      public int size()
      Specified by:
      size in interface PromisedValues<T>
      Returns:
      the number of CompletionStages under the covers
    • join

      public List<T> join()
      Description copied from interface: PromisedValues
      Waits for the underlying futures to complete. To better conform with the use of common functional forms, if a computation involved in the completion of this CompletableFuture threw an exception, this method throws an (unchecked) CompletionException with the underlying exception as its cause.
      Specified by:
      join in interface PromisedValues<T>
      Returns:
      the list of completed values similar to PromisedValues.toList()
    • toCompletableFuture

      public CompletableFuture<List<T>> toCompletableFuture()
      Specified by:
      toCompletableFuture in interface PromisedValues<T>
      Returns:
      this as a CompletableFuture that returns the list of underlying values