ExistingWorkPolicy
public enum ExistingWorkPolicy extends 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 methods |
|
|---|---|
final @NonNull EnumEntries<@NonNull ExistingWorkPolicy> |
Returns an immutable |
static final @NonNull ExistingWorkPolicy |
Returns the enum constant of this type with the specified name. |
static final @NonNull ExistingWorkPolicy[] |
values()Returns an array containing the constants of this enum type, in the order they're declared. |
Enum Values
APPEND
ExistingWorkPolicy ExistingWorkPolicy.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. 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
ExistingWorkPolicy ExistingWorkPolicy.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. 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
ExistingWorkPolicy ExistingWorkPolicy.KEEP
If there is existing pending (uncompleted) work with the same unique name, do nothing. Otherwise, insert the newly-specified work.
REPLACE
ExistingWorkPolicy ExistingWorkPolicy.REPLACE
If there is existing pending (uncompleted) work with the same unique name, cancel and delete it. Then, insert the newly-specified work.
Public methods
getEntries
public final @NonNull EnumEntries<@NonNull ExistingWorkPolicy> getEntries()
Returns an immutable kotlin.enums.EnumEntries list containing the constants of this enum type, in the order they're declared.
valueOf
public static final @NonNull ExistingWorkPolicy valueOf(@NonNull String value)
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
public static final @NonNull ExistingWorkPolicy[] values()
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.
The function returns a new instance of the array on every call. The array could be mutated, so working with it may also require defensive copying. Consider using entries property as a more efficient alternative returning an immutable list of enum entries.