BackupActionResult


public sealed class BackupActionResult

Known direct subclasses
BackupActionResult.Failure

Indicates that the device payload failed during execution or verification.

BackupActionResult.Success

Indicates that the device payload executed and verified successfully.


Represents the result of a delegated device payload execution.

Note: This sealed class is open to future additions. Consumers should use a non-exhaustive 'when' pattern-matching approach (incorporating an explicit 'else' branch) to ensure binary compatibility when new subclasses are introduced.

Summary

Nested types

Indicates that the device payload failed during execution or verification.

Indicates that the device payload executed and verified successfully.

Protected constructors

Public methods

abstract @NonNull Map<@NonNull String, @NonNull String>

Data that the action returned, such as values it read on the device.

final @NonNull Map<@NonNull String, @NonNull String>

Returns the data of a Success, or throws an IOException for a Failure, as BackupRestoreController.runBackupRestoreFlow does when one of its actions fails.

final boolean

Returns true if this is a Success result.

Protected constructors

BackupActionResult

protected BackupActionResult()

Public methods

getData

Added in 1.0.0-alpha04
public abstract @NonNull Map<@NonNull String, @NonNull String> getData()

Data that the action returned, such as values it read on the device. Empty if the action returned none or didn't run to completion. The data of a Failure leaves out the status and error of the action, which Failure.errorMessage reports. A result keeps a copy of the data that it's created with.

getOrThrow

Added in 1.0.0-alpha04
public final @NonNull Map<@NonNull String, @NonNull String> getOrThrow()

Returns the data of a Success, or throws an IOException for a Failure, as BackupRestoreController.runBackupRestoreFlow does when one of its actions fails.

The exception message has the Failure.errorMessage and the Failure.stackTrace that the device sent. To read a Failure itself, such as its data, check the type of this result instead.

Throws
IOException

if this is a Failure

isSuccess

Added in 1.0.0-alpha04
public final boolean isSuccess()

Returns true if this is a Success result.