PeopleContract.Persons.Query.Builder


public static final class PeopleContract.Persons.Query.Builder
extends Object

java.lang.Object
   ↳ android.provider.PeopleContract.Persons.Query.Builder


Helper class for building structured query argument bundles to pass into ContentResolver.query(Uri,String[],Bundle,CancellationSignal) when querying Persons.CONTENT_URI.

Multiple sub-queries targeting different directory packages or selection criteria can be combined onto a single builder instance before calling build().

Summary

Public constructors

Builder()

Constructs a new empty instance of Builder.

Public methods

PeopleContract.Persons.Query.Builder addEmailQuery(String packageName, List<String> emailAddresses)

Adds a sub-query searching for person records that match the given list of email addresses within the specified directory package.

PeopleContract.Persons.Query.Builder addGroupQuery(String packageName, List<String> groupLookupKeys)

Adds a sub-query searching for person records that are members of groups matching the given list of group lookup keys within the specified directory package.

PeopleContract.Persons.Query.Builder addLookupQuery(String packageName, List<String> lookupKeys)

Adds a sub-query searching for specific person records matching the given list of opaque lookup keys within the specified directory package.

PeopleContract.Persons.Query.Builder addPhoneQuery(String packageName, List<String> phones)

Adds a sub-query searching for person records that match the given list of phone numbers within the specified directory package.

Bundle build()

Generates the final query arguments Bundle containing all configured sub-queries.

Inherited methods

Public constructors

Builder

Added in API level 10000
public Builder ()

Constructs a new empty instance of Builder.

Public methods

addEmailQuery

Added in API level 10000
public PeopleContract.Persons.Query.Builder addEmailQuery (String packageName, 
                List<String> emailAddresses)

Adds a sub-query searching for person records that match the given list of email addresses within the specified directory package.

Parameters
packageName String: The package name of the target directory application.
This value cannot be null.

emailAddresses List: A list of email address strings to search for.
This value cannot be null.

Returns
PeopleContract.Persons.Query.Builder This builder instance for method chaining.
This value cannot be null.

addGroupQuery

Added in API level 10000
public PeopleContract.Persons.Query.Builder addGroupQuery (String packageName, 
                List<String> groupLookupKeys)

Adds a sub-query searching for person records that are members of groups matching the given list of group lookup keys within the specified directory package.

Parameters
packageName String: The package name of the target directory application.
This value cannot be null.

groupLookupKeys List: A list of group lookup key strings to search within.
This value cannot be null.

Returns
PeopleContract.Persons.Query.Builder This builder instance for method chaining.
This value cannot be null.

addLookupQuery

Added in API level 10000
public PeopleContract.Persons.Query.Builder addLookupQuery (String packageName, 
                List<String> lookupKeys)

Adds a sub-query searching for specific person records matching the given list of opaque lookup keys within the specified directory package.

Parameters
packageName String: The package name of the target directory application.
This value cannot be null.

lookupKeys List: A list of person lookup key strings to resolve.
This value cannot be null.

Returns
PeopleContract.Persons.Query.Builder This builder instance for method chaining.
This value cannot be null.

addPhoneQuery

Added in API level 10000
public PeopleContract.Persons.Query.Builder addPhoneQuery (String packageName, 
                List<String> phones)

Adds a sub-query searching for person records that match the given list of phone numbers within the specified directory package.

Parameters
packageName String: The package name of the target directory application.
This value cannot be null.

phones List: A list of phone number strings to search for. Required to be in E.164 standard format.
This value cannot be null.

Returns
PeopleContract.Persons.Query.Builder This builder instance for method chaining.
This value cannot be null.

build

Added in API level 10000
public Bundle build ()

Generates the final query arguments Bundle containing all configured sub-queries.

The returned bundle can be passed directly as the query arguments parameter to ContentResolver.query(Uri,String[],Bundle,CancellationSignal).

Returns
Bundle A Bundle containing the accumulated query requests under PeopleContract.QUERY_ARG_QUERIES.
This value cannot be null.