public final class Producers extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> com.google.common.util.concurrent.ListenableFuture<Produced<T>> |
createFutureProduced(com.google.common.util.concurrent.ListenableFuture<T> future)
Returns a future of
Produced that represents the completion (either success or failure)
of the given future. |
static <T> com.google.common.util.concurrent.ListenableFuture<Set<T>> |
createFutureSingletonSet(com.google.common.util.concurrent.ListenableFuture<T> future)
Returns a future of a
Set that contains a single element: the result of the input
future. |
static <T> Producer<T> |
immediateFailedProducer(Throwable throwable)
Returns a producer that fails with the given exception.
|
static <T> Producer<T> |
immediateProducer(T value)
Returns a producer that succeeds with the given value.
|
static <T> Producer<T> |
producerFromProvider(javax.inject.Provider<T> provider)
Returns a producer that immediately executes the binding logic for the given provider every
time it is called.
|
public static <T> com.google.common.util.concurrent.ListenableFuture<Produced<T>> createFutureProduced(com.google.common.util.concurrent.ListenableFuture<T> future)
Produced that represents the completion (either success or failure)
of the given future. If the input future succeeds, then the resulting future also succeeds with
a successful Produced; if the input future fails, then the resulting future succeeds
with a failing Produced.
Cancelling the resulting future will propagate the cancellation to the input future; but
cancelling the input future will trigger the resulting future to succeed with a failing
Produced.
public static <T> com.google.common.util.concurrent.ListenableFuture<Set<T>> createFutureSingletonSet(com.google.common.util.concurrent.ListenableFuture<T> future)
Set that contains a single element: the result of the input
future.public static <T> Producer<T> producerFromProvider(javax.inject.Provider<T> provider)
public static <T> Producer<T> immediateProducer(T value)
Copyright © 2016 Google, Inc.. All Rights Reserved.