PendingResults

public final class PendingResults


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

Summary

Public methods

static PendingResult<Status>

Returns a PendingResult that has been canceled.

static PendingResult<R>
<R extends Result> canceledPendingResult(R result)

Returns a PendingResult that has been canceled.

static OptionalPendingResult<R>
<R extends Result> immediatePendingResult(R result)

Returns a PendingResult with the specified result.

static PendingResult<Status>

Returns a PendingResult with the specified Status.

Public methods

canceledPendingResult

public static PendingResult<StatuscanceledPendingResult()

Returns a PendingResult that has been canceled.

canceledPendingResult

public static PendingResult<R> <R extends Result> canceledPendingResult(R result)

Returns a PendingResult that has been canceled.

Parameters
R result

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

immediatePendingResult

public static OptionalPendingResult<R> <R extends Result> immediatePendingResult(R result)

Returns a PendingResult with the specified result.

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

Calling cancel on the returned PendingResult is not supported.

immediatePendingResult

public static PendingResult<StatusimmediatePendingResult(Status result)

Returns a PendingResult with the specified Status.

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