WorkQuery.Builder


class WorkQuery.Builder


A builder for WorkQuery.

Summary

Public companion functions

WorkQuery.Builder
fromIds(ids: List<UUID>)

Creates a WorkQuery.Builder with a List of WorkRequest ids.

WorkQuery.Builder

Creates a WorkQuery.Builder with a List of WorkInfo.State states.

WorkQuery.Builder

Creates a WorkQuery.Builder with a List of WorkRequest tags.

WorkQuery.Builder
fromUniqueWorkNames(uniqueWorkNames: List<String>)

Creates a WorkQuery.Builder with a List of uniqueWorkNames.

Public functions

WorkQuery.Builder
addIds(ids: List<UUID>)

Adds a List of WorkRequest ids to the WorkQuery

WorkQuery.Builder

Adds a List of WorkInfo.States to the WorkQuery.

WorkQuery.Builder

Adds a List of WorkRequest tag to the WorkQuery.

WorkQuery.Builder
addUniqueWorkNames(uniqueWorkNames: List<String>)

Adds a List of uniqueWorkNames to the WorkQuery

WorkQuery

Creates an instance of WorkQuery.

Public companion functions

fromIds

Added in 2.10.0
fun fromIds(ids: List<UUID>): WorkQuery.Builder

Creates a WorkQuery.Builder with a List of WorkRequest ids.

Parameters
ids: List<UUID>

The List of WorkRequest ids.

Returns
WorkQuery.Builder

a Builder instance

fromStates

fun fromStates(states: List<WorkInfo.State>): WorkQuery.Builder

Creates a WorkQuery.Builder with a List of WorkInfo.State states.

Parameters
states: List<WorkInfo.State>

The List of WorkInfo.State to add to the WorkQuery

Returns
WorkQuery.Builder

a Builder instance

fromTags

Added in 2.10.0
fun fromTags(tags: List<String>): WorkQuery.Builder

Creates a WorkQuery.Builder with a List of WorkRequest tags.

Parameters
tags: List<String>

The List of WorkRequest tags

Returns
WorkQuery.Builder

a Builder instance

fromUniqueWorkNames

Added in 2.10.0
fun fromUniqueWorkNames(uniqueWorkNames: List<String>): WorkQuery.Builder

Creates a WorkQuery.Builder with a List of uniqueWorkNames.

Parameters
uniqueWorkNames: List<String>

The List of unique work names

Returns
WorkQuery.Builder

a Builder instance

Public functions

addIds

Added in 2.5.0
fun addIds(ids: List<UUID>): WorkQuery.Builder

Adds a List of WorkRequest ids to the WorkQuery

Parameters
ids: List<UUID>

The List ids to add

Returns
WorkQuery.Builder

the instance of the Builder

addStates

Added in 2.4.0
fun addStates(states: List<WorkInfo.State>): WorkQuery.Builder

Adds a List of WorkInfo.States to the WorkQuery.

Parameters
states: List<WorkInfo.State>

The List of WorkInfo.States to add

Returns
WorkQuery.Builder

the instance of the Builder

addTags

Added in 2.4.0
fun addTags(tags: List<String>): WorkQuery.Builder

Adds a List of WorkRequest tag to the WorkQuery.

Parameters
tags: List<String>

The List of WorkRequest tags to add

Returns
WorkQuery.Builder

the instance of the Builder

addUniqueWorkNames

Added in 2.4.0
fun addUniqueWorkNames(uniqueWorkNames: List<String>): WorkQuery.Builder

Adds a List of uniqueWorkNames to the WorkQuery

Parameters
uniqueWorkNames: List<String>

The List of unique work names to add

Returns
WorkQuery.Builder

the instance of the Builder

build

Added in 2.4.0
fun build(): WorkQuery

Creates an instance of WorkQuery.

Returns
WorkQuery

the WorkQuery instance

Throws
kotlin.IllegalArgumentException

if neither of ids, uniqueWorkNames, tags or states is set.