Class Futures.AugmentedFuture<A>

java.lang.Object
scala.AnyVal
com.here.platform.data.client.utils.Futures.AugmentedFuture<A>
Enclosing class:
Futures

public static final class Futures.AugmentedFuture<A> extends scala.AnyVal
  • Constructor Summary

    Constructors
    Constructor
    Description
    AugmentedFuture(scala.concurrent.Future<A> self)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    scala.concurrent.Future<A>
    augmentedHandleFailure(scala.Function1<Throwable,scala.runtime.BoxedUnit> action, scala.concurrent.ExecutionContext executor)
    Causes an asynchronous side effect in case the future fails.
    <B> scala.concurrent.Future<B>
    augmentedMapTry(scala.Function1<scala.util.Try<A>,B> f, scala.concurrent.ExecutionContext executor)
    Map over the inner Try[A] completion value of the future, rather than the A success value like the normal scala.concurrent.Future.map method.
    scala.concurrent.Future<scala.Option<A>>
    augmentedToOption(scala.concurrent.ExecutionContext executor)
    Converts the "inner Try" of the Future to an option, wrapping successful values in Some and replacing failures with None.
    <B> scala.concurrent.Future<B>
    augmentedTransformWith(scala.Function1<scala.util.Try<A>,scala.concurrent.Future<B>> f, scala.concurrent.ExecutionContext executor)
    Flat-map over the inner Try[A] completion value of the future, rather than the A success value like the normal scala.concurrent.Future.flatMap method.
    scala.concurrent.Future<A>
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AugmentedFuture

      public AugmentedFuture(scala.concurrent.Future<A> self)
  • Method Details

    • self

      public scala.concurrent.Future<A> self()
    • augmentedMapTry

      public <B> scala.concurrent.Future<B> augmentedMapTry(scala.Function1<scala.util.Try<A>,B> f, scala.concurrent.ExecutionContext executor)
      Map over the inner Try[A] completion value of the future, rather than the A success value like the normal scala.concurrent.Future.map method.
    • augmentedTransformWith

      public <B> scala.concurrent.Future<B> augmentedTransformWith(scala.Function1<scala.util.Try<A>,scala.concurrent.Future<B>> f, scala.concurrent.ExecutionContext executor)
      Flat-map over the inner Try[A] completion value of the future, rather than the A success value like the normal scala.concurrent.Future.flatMap method.

      Note that this method is provided by Future starting in Scala 2.12.

    • augmentedToOption

      public scala.concurrent.Future<scala.Option<A>> augmentedToOption(scala.concurrent.ExecutionContext executor)
      Converts the "inner Try" of the Future to an option, wrapping successful values in Some and replacing failures with None.

      This is useful if the result will just not be used in the case of an error.

    • augmentedHandleFailure

      public scala.concurrent.Future<A> augmentedHandleFailure(scala.Function1<Throwable,scala.runtime.BoxedUnit> action, scala.concurrent.ExecutionContext executor)
      Causes an asynchronous side effect in case the future fails.

      Note that the original future is returned, meaning that it will be completed before the action has completed.