GlobalSearchApplicationInfo.Builder


public final class GlobalSearchApplicationInfo.Builder


Builder class for GlobalSearchApplicationInfo.

Summary

Protected fields

final int
final String
final String
List<String>

Public constructors

Builder(@NonNull String namespace, @NonNull String id, int applicationType)

Constructs a new Builder.

Public methods

@NonNull GlobalSearchApplicationInfo

Constructs a new GlobalSearchApplicationInfo.

@NonNull T

Sets the list of schemas this app is capable of producing (if getApplicationType is APPLICATION_TYPE_PRODUCER) or interested in consuming (if is #APPLICATION_TYPE_CONSUMER).

@NonNull T

Sets the list of schema type names this app is capable of producing (if getApplicationType is APPLICATION_TYPE_PRODUCER) or interested in consuming (if is #APPLICATION_TYPE_CONSUMER).

Protected fields

mApplicationType

protected final int mApplicationType

mId

protected final String mId

mNamespace

protected final String mNamespace

mSchemaTypes

protected List<StringmSchemaTypes

Public constructors

Builder

Added in 1.1.0
public Builder(@NonNull String namespace, @NonNull String id, int applicationType)

Constructs a new Builder.

Parameters
@NonNull String namespace

an arbitrary string corresponding to a logical grouping for this GlobalSearchApplicationInfo. All AppSearch documents must have a namespace.

@NonNull String id

the identifier for this GlobalSearchApplicationInfo. AppSearch IDs are unique within their combination of package, database and namespace.

int applicationType

whether the application is capable of producing, or interested in consuming, the schema types configured by setSchemaTypes or setDocumentClasses.

Public methods

build

Added in 1.1.0
public @NonNull GlobalSearchApplicationInfo build()

Constructs a new GlobalSearchApplicationInfo.

setDocumentClasses

Added in 1.1.0
public @NonNullsetDocumentClasses(@NonNull List<@NonNull Class<Object>> schemaClasses)

Sets the list of schemas this app is capable of producing (if getApplicationType is APPLICATION_TYPE_PRODUCER) or interested in consuming (if is #APPLICATION_TYPE_CONSUMER).

This method is equivalent to setSchemaTypes but accepts document classes instead of schema name strings.

Parameters
@NonNull List<@NonNull Class<Object>> schemaClasses

A list of classes annotated with the @Document annotation which correspond to the schemas this app produces or consumes.

Throws
androidx.appsearch.exceptions.AppSearchException

if the schemaClasses are not @Document-annotated classes or extraction of the schema name fails.

setSchemaTypes

Added in 1.1.0
public @NonNullsetSchemaTypes(@NonNull List<@NonNull String> schemaTypes)

Sets the list of schema type names this app is capable of producing (if getApplicationType is APPLICATION_TYPE_PRODUCER) or interested in consuming (if is #APPLICATION_TYPE_CONSUMER).

This method is equivalent to setDocumentClasses but accepts schema name strings instead of extracting schema information from document classes.