SetSchemaRequest.Builder

public static final class SetSchemaRequest.Builder
extends Object

java.lang.Object
   ↳ androidx.appsearch.app.SetSchemaRequest.Builder


Builder for SetSchemaRequest objects.

Summary

Public constructors

Builder()

Public methods

SetSchemaRequest.Builder addDocumentClasses(Class...<?> documentClasses)

Adds one or more Document annotated classes to the schema.

SetSchemaRequest.Builder addDocumentClasses(Collection<? extends Class<?>> documentClasses)

Adds a collection of Document annotated classes to the schema.

SetSchemaRequest.Builder addSchemas(AppSearchSchema... schemas)

Adds one or more AppSearchSchema types to the schema.

SetSchemaRequest.Builder addSchemas(Collection<AppSearchSchema> schemas)

Adds a collection of AppSearchSchema objects to the schema.

SetSchemaRequest build()

Builds a new SetSchemaRequest object.

SetSchemaRequest.Builder setDocumentClassDisplayedBySystem(Class<?> documentClass, boolean displayed)

Sets whether or not documents from the provided Document annotated class will be displayed and visible on any system UI surface.

SetSchemaRequest.Builder setDocumentClassVisibilityForPackage(Class<?> documentClass, boolean visible, PackageIdentifier packageIdentifier)

Sets whether or not documents from the provided Document annotated class can be read by the specified package.

SetSchemaRequest.Builder setForceOverride(boolean forceOverride)

Sets whether or not to override the current schema in the AppSearchSession database.

SetSchemaRequest.Builder setMigrator(String schemaType, Migrator migrator)

Sets the Migrator associated with the given SchemaType.

SetSchemaRequest.Builder setMigrators(Map<String, Migrator> migrators)

Sets a Map of Migrators.

SetSchemaRequest.Builder setSchemaTypeDisplayedBySystem(String schemaType, boolean displayed)

Sets whether or not documents from the provided schemaType will be displayed and visible on any system UI surface.

SetSchemaRequest.Builder setSchemaTypeVisibilityForPackage(String schemaType, boolean visible, PackageIdentifier packageIdentifier)

Sets whether or not documents from the provided schemaType can be read by the specified package.

SetSchemaRequest.Builder setVersion(int version)

Sets the version number of the overall AppSearchSchema in the database.

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

addDocumentClasses

public SetSchemaRequest.Builder addDocumentClasses (Class...<?> documentClasses)

Adds one or more Document annotated classes to the schema.

Parameters
documentClasses Class: classes annotated with Document.

Returns
SetSchemaRequest.Builder

Throws
AppSearchException if androidx.appsearch.compiler.AppSearchCompiler has not generated a schema for the given document classes.

addDocumentClasses

public SetSchemaRequest.Builder addDocumentClasses (Collection<? extends Class<?>> documentClasses)

Adds a collection of Document annotated classes to the schema.

Parameters
documentClasses Collection: classes annotated with Document.

Returns
SetSchemaRequest.Builder

Throws