GlobalSearchApplicationInfo.Builder


public final class GlobalSearchApplicationInfo.Builder


Builder class for GlobalSearchApplicationInfo.

Summary

Public constructors

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

Constructs a new Builder.

Public methods

@NonNull GlobalSearchApplicationInfo

Constructs a new GlobalSearchApplicationInfo.

@NonNull GlobalSearchApplicationInfo.Builder

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 GlobalSearchApplicationInfo.Builder

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).

Public constructors

Builder

Added in 1.1.0-beta01
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

setDocumentClasses

Added in 1.1.0-beta01
public @NonNull GlobalSearchApplicationInfo.Builder setDocumentClasses(@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-beta01
public @NonNull GlobalSearchApplicationInfo.Builder setSchemaTypes(@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.