ExistingWorkPolicy


enum ExistingWorkPolicy : Enum


An enumeration of the conflict resolution policies available to unique OneTimeWorkRequests in case of a collision.

Summary

Enum Values

APPEND

If there is existing pending (uncompleted) work with the same unique name, append the newly-specified work as a child of all the leaves of that work sequence.

APPEND_OR_REPLACE

If there is existing pending (uncompleted) work with the same unique name, append the newly-specified work as the child of all the leaves of that work sequence.

KEEP

If there is existing pending (uncompleted) work with the same unique name, do nothing.

REPLACE

If there is existing pending (uncompleted) work with the same unique name, cancel and delete it.

Public functions

ExistingWorkPolicy
valueOf(value: String)

Returns the enum constant of this type with the specified name.

Array<ExistingWorkPolicy>

Returns an array containing the constants of this enum type, in the order they're declared.

Public properties

EnumEntries<ExistingWorkPolicy>

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Enum Values

APPEND

val ExistingWorkPolicy.APPENDExistingWorkPolicy

If there is existing pending (uncompleted) work with the same unique name, append the newly-specified work as a child of all the leaves of that work sequence. Otherwise, insert the newly-specified work as the start of a new sequence.

Note: When using APPEND with failed or cancelled prerequisites, newly enqueued work will also be marked as failed or cancelled respectively. Use ExistingWorkPolicy.APPEND_OR_REPLACE to create a new chain of work.

APPEND_OR_REPLACE

val ExistingWorkPolicy.APPEND_OR_REPLACEExistingWorkPolicy

If there is existing pending (uncompleted) work with the same unique name, append the newly-specified work as the child of all the leaves of that work sequence. Otherwise, insert the newly-specified work as the start of a new sequence.

Note: If there are failed or cancelled prerequisites, these prerequisites are dropped and the newly-specified work is the start of a new sequence.

KEEP

val ExistingWorkPolicy.KEEPExistingWorkPolicy

If there is existing pending (uncompleted) work with the same unique name, do nothing. Otherwise, insert the newly-specified work.

REPLACE

val ExistingWorkPolicy.REPLACEExistingWorkPolicy

If there is existing pending (uncompleted) work with the same unique name, cancel and delete it. Then, insert the newly-specified work.

Public functions

valueOf

Added in 1.0.0
fun valueOf(value: String): ExistingWorkPolicy

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Throws
kotlin.IllegalArgumentException

if this enum type has no constant with the specified name

values

Added in 1.0.0
fun values(): Array<ExistingWorkPolicy>

Returns an array containing the constants of this enum type, in the order they're declared.

This method may be used to iterate over the constants.

Public properties

entries

val entriesEnumEntries<ExistingWorkPolicy>

Returns a representation of an immutable list of all enum entries, in the order they're declared.

This method may be used to iterate over the enum entries.