WorkQuery


public final class WorkQuery


A specification for querying WorkRequests. This is comprised of 4 components; namely ids, unique work names, tags & work states.

A List of WorkRequest ids, or a List of unique work names, or a List of WorkRequest tags, or a List of WorkInfo.State can be specified.

Each component in a WorkQuery is AND-ed with the others. Each value in a component is OR-ed.

Example: (id1 OR id2 OR ...) AND (name1 OR name2 OR ...) AND (tag1 OR tag2 OR ...) AND (state1 OR state2 OR ...)

Summary

Nested types

public final class WorkQuery.Builder

A builder for WorkQuery.

Public methods

static final @NonNull WorkQuery

Creates a query for WorkRequests with the given ids.

static final @NonNull WorkQuery

Creates a query for WorkRequests with the given ids.

static final @NonNull WorkQuery

Creates a WorkQuery for the workers in the given WorkInfo.State states.

static final @NonNull WorkQuery

Creates a WorkQuery for the workers in the given WorkInfo.State states.

static final @NonNull WorkQuery

Creates a query for WorkRequests with the given tags.

static final @NonNull WorkQuery

Creates a query for WorkRequests with the given tags.

static final @NonNull WorkQuery

Creates a query for WorkRequests with the given unique names.

static final @NonNull WorkQuery

Creates a query for WorkRequests with the given unique names.

final @NonNull List<@NonNull UUID>

The List of WorkRequest ids being queried.

final @NonNull List<@NonNull WorkInfo.State>

The List of WorkInfo.States being queried

final @NonNull List<@NonNull String>

The List of tags being queried

final @NonNull List<@NonNull String>

The List of unique works name being queried

Public methods

fromIds

Added in 2.10.0
public static final @NonNull WorkQuery fromIds(@NonNull List<@NonNull UUID> ids)

Creates a query for WorkRequests with the given ids.

Parameters
@NonNull List<@NonNull UUID> ids

list of ids of WorkRequests

Returns
@NonNull WorkQuery

a requested WorkQuery

fromIds

Added in 2.10.0
public static final @NonNull WorkQuery fromIds(@NonNull UUID ids)

Creates a query for WorkRequests with the given ids.

Parameters
@NonNull UUID ids

ids of WorkRequests

Returns
@NonNull WorkQuery

a requested WorkQuery

fromStates

public static final @NonNull WorkQuery fromStates(@NonNull List<@NonNull WorkInfo.State> states)

Creates a WorkQuery for the workers in the given WorkInfo.State states.

Parameters
@NonNull List<@NonNull WorkInfo.State> states

The List of WorkInfo.State

Returns
@NonNull WorkQuery

a requested WorkQuery

fromStates

Added in 2.10.0
public static final @NonNull WorkQuery fromStates(@NonNull WorkInfo.State states)

Creates a WorkQuery for the workers in the given WorkInfo.State states.

Parameters
@NonNull WorkInfo.State states

states of workers

Returns
@NonNull WorkQuery

a requested WorkQuery

fromTags

Added in 2.10.0
public static final @NonNull WorkQuery fromTags(@NonNull List<@NonNull String> tags)

Creates a query for WorkRequests with the given tags.

Parameters
@NonNull List<@NonNull String> tags

tags of WorkRequests

Returns
@NonNull WorkQuery

a requested WorkQuery

fromTags

Added in 2.10.0
public static final @NonNull WorkQuery fromTags(@NonNull String tags)

Creates a query for WorkRequests with the given tags.

Parameters
@NonNull String tags

tags of WorkRequests

Returns
@NonNull WorkQuery

a requested WorkQuery

fromUniqueWorkNames

Added in 2.10.0
public static final @NonNull WorkQuery fromUniqueWorkNames(@NonNull List<@NonNull String> uniqueWorkNames)

Creates a query for WorkRequests with the given unique names.

Parameters
@NonNull List<@NonNull String> uniqueWorkNames

The List of unique work names

Returns
@NonNull WorkQuery

a requested WorkQuery

fromUniqueWorkNames

Added in 2.10.0
public static final @NonNull WorkQuery fromUniqueWorkNames(@NonNull String uniqueWorkNames)

Creates a query for WorkRequests with the given unique names.

Parameters
@NonNull String uniqueWorkNames

unique work names

Returns
@NonNull WorkQuery

a requested WorkQuery

getIds

Added in 2.5.0
public final @NonNull List<@NonNull UUIDgetIds()

The List of WorkRequest ids being queried.

getStates

Added in 2.4.0
public final @NonNull List<@NonNull WorkInfo.StategetStates()

The List of WorkInfo.States being queried

getTags

Added in 2.4.0
public final @NonNull List<@NonNull StringgetTags()

The List of tags being queried

getUniqueWorkNames

Added in 2.4.0
public final @NonNull List<@NonNull StringgetUniqueWorkNames()

The List of unique works name being queried