PendingResults

public final class PendingResults extends Object

Provides factory methods for PendingResult instances, primarily for use in tests.

Public Method Summary

static PendingResult<Status>
canceledPendingResult()
Returns a PendingResult that has been canceled.
static <R extends Result> PendingResult<R>
canceledPendingResult(R result)
Returns a PendingResult that has been canceled.
static <R extends Result> OptionalPendingResult<R>
immediatePendingResult(R result)
Returns a PendingResult with the specified result.
static PendingResult<Status>
immediatePendingResult(Status result)
Returns a PendingResult with the specified Status.

Inherited Method Summary

Public Methods

public static PendingResult<Status> canceledPendingResult ()

Returns a PendingResult that has been canceled.

public static PendingResult<R> canceledPendingResult (R result)

Returns a PendingResult that has been canceled.

Parameters
result The canceled result. Must have a status code of CommonStatusCodes.CANCELED.

public static OptionalPendingResult<R> immediatePendingResult (R result)

Returns a PendingResult with the specified result.

If PendingResult.setResultCallback(ResultCallback ) is called on the returned PendingResult then ResultCallback.onResult(R) will immediately be called on the main thread. If PendingResult.await() is called it will immediate return result.

Calling PendingResult.cancel() on the returned PendingResult is not supported.

public static PendingResult<Status> immediatePendingResult (Status result)

Returns a PendingResult with the specified Status.

If PendingResult.setResultCallback(ResultCallback ) is called on the returned PendingResult then ResultCallback.onResult(R) will immediately be called on the main thread. If PendingResult.await() is called it will immediate return result.