Summary: Ctors | Methods | Inherited Methods | [Expand All]
public abstract class

# ResultTransform

extends Object

java.lang.Object
↳ | com.google.android.gms.common.api.ResultTransform<R extends com.google.android.gms.common.api.Result, S extends com.google.android.gms.common.api.Result>

## Class Overview

Transforms a `Result` by making a subsequent API call.

##### See Also

- `then(ResultTransform)`

## Summary

Public Constructors
| ResultTransform()

Public Methods
final PendingResult<S> | createFailedResult(Status status) Creates a failed result with the given `Status`.
Status | onFailure(Status status) Called when the PendingResult to be transformed returns a failure.
abstract PendingResult<S> | onSuccess(R result) Transforms the result of a successful API call.

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()

## Public Constructors

#### public ResultTransform ()

## Public Methods

#### public final PendingResult<S> createFailedResult (Status status)

Creates a failed result with the given `Status`. In the event of an error during `onSuccess(R)`, call this method and return the failed result.

Note: the `PendingResult` generated by this method must be returned directly from `onSuccess(R)`. It is an error to call any methods on this PendingResult.

#### public Status onFailure (Status status)

Called when the PendingResult to be transformed returns a failure. Default implementation simply propagates the failure, but subclasses may override for custom failure handling. This method is called on the main thread, unless overridden by `setHandler(Handler)`.

##### Parameters

status | The status of the failure.

##### Returns

- The status of the result of the transformation. Must not be success or null.

#### public abstract PendingResult<S> onSuccess (R result)

Transforms the result of a successful API call. This method is called on a background thread and should not access UI elements.

##### Parameters

result | The successful result to be transformed. Never null. If this result is `Releasable` it will be automatically released after this transform is applied; it is not necessary to release the result inside onSuccess. It is an error to set callbacks on this result. Any callbacks set on this result will be overridden and will not be called.

##### Returns

- The result of the transformation. Normally the result of another API call. To shortcut execution and directly yield a failure, return either:
  - `null`, which is translated into a `Status` with code `ERROR`; or
  - a specific failure created using `createFailedResult(Status)`.