Stay organized with collections Save and categorize content based on your preferences.

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 @NonNull WorkQuery
fromIds(@NonNull UUID[] ids)

Creates a query for WorkRequests with the given ids.

static @NonNull WorkQuery

Creates a query for WorkRequests with the given ids.

static @NonNull WorkQuery
fromStates(@NonNull WorkInfo.State[] states)

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

static @NonNull WorkQuery

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

static @NonNull WorkQuery
fromTags(@NonNull String[] tags)

Creates a query for WorkRequests with the given tags.

static @NonNull WorkQuery

Creates a query for WorkRequests with the given tags.

static @NonNull WorkQuery
fromUniqueWorkNames(@NonNull String[] uniqueWorkNames)

Creates a query for WorkRequests with the given unique names.

static @NonNull WorkQuery

Creates a query for WorkRequests with the given unique names.

@NonNull List<UUID>
@NonNull List<WorkInfo.State>
@NonNull List<String>
@NonNull List<String>

Public methods

fromIds

public static @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

fromIds

public static @NonNull WorkQuery fromIds(@NonNull List<UUID> ids)

Creates a query for WorkRequests with the given ids.

Parameters
@NonNull List<UUID> ids

list of ids of WorkRequests

Returns
@NonNull WorkQuery

a requested WorkQuery

fromStates

public static @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

fromStates

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

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

Parameters
@NonNull List<WorkInfo.State> states

The List of WorkInfo.State

Returns
@NonNull WorkQuery

a requested WorkQuery

fromTags

public static @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

fromTags

public static @NonNull WorkQuery fromTags(@NonNull List<String> tags)

Creates a query for WorkRequests with the given tags.

Parameters
@NonNull List<String> tags

tags of WorkRequests

Returns
@NonNull WorkQuery

a requested WorkQuery

fromUniqueWorkNames

public static @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

fromUniqueWorkNames

public static @NonNull WorkQuery fromUniqueWorkNames(@NonNull List<String> uniqueWorkNames)

Creates a query for WorkRequests with the given unique names.

Parameters
@NonNull List<String> uniqueWorkNames

The List of unique work names

Returns
@NonNull WorkQuery

a requested WorkQuery

getIds

public @NonNull List<UUIDgetIds()
Returns
@NonNull List<UUID>

The List of WorkRequest ids being queried.

getStates

public @NonNull List<WorkInfo.StategetStates()
Returns
@NonNull List<WorkInfo.State>

the List of WorkInfo.States being queried

getTags

public @NonNull List<StringgetTags()
Returns
@NonNull List<String>

the List of tags being queried

getUniqueWorkNames

public @NonNull List<StringgetUniqueWorkNames()
Returns
@NonNull List<String>

the List of unique works name being queried