# Print output for @column tags ?> SetSchemaRequest - Android SDK | Android Developers

Most visited

Recently visited

SetSchemaRequest

public final class SetSchemaRequest
extends Object

java.lang.Object
   ↳ android.app.appsearch.SetSchemaRequest


Encapsulates a request to update the schema of an AppSearchSession database.

The schema is composed of a collection of AppSearchSchema objects, each of which defines a unique type of data.

The first call to SetSchemaRequest will set the provided schema and store it within the AppSearchSession database.

Subsequent calls will compare the provided schema to the previously saved schema, to determine how to treat existing documents.

The following types of schema modifications are always safe and are made without deleting any existing documents:

  • Addition of new AppSearchSchema types
  • Addition of new properties to an existing AppSearchSchema type
  • Changing the cardinality of a property to be less restrictive

The following types of schema changes are not backwards compatible:

  • Removal of an existing AppSearchSchema type
  • Removal of a property from an existing AppSearchSchema type
  • Changing the data type of an existing property
  • Changing the cardinality of a property to be more restrictive

Providing a schema with incompatible changes, will throw an AppSearchException, with a message describing the incompatibility. As a result, the previously set schema will remain unchanged.

Backward incompatible changes can be made by :

See also:

Summary

Nested classes

class SetSchemaRequest.Builder

Builder for SetSchemaRequest objects. 

Public methods

Map<StringMigrator> getMigrators()

Returns the map of Migrator, the key will be the schema type of the Migrator associated with.

Set<AppSearchSchema> getSchemas()

Returns the AppSearchSchema types that are part of this request.

Set<String> getSchemasNotDisplayedBySystem()

Returns all the schema types that are opted out of being displayed and visible on any system UI surface.

Map<StringSet<PackageIdentifier>> getSchemasVisibleToPackages()

Returns a mapping of schema types to the set of packages that have access to that schema type.

int getVersion()

Returns the database overall schema version.

boolean isForceOverride()

Returns whether this request will force the schema to be overridden.

Inherited methods

Public methods

getMigrators

public Map<StringMigrator> getMigrators ()

Returns the map of Migrator, the key will be the schema type of the Migrator associated with.

Returns
Map<StringMigrator> This value cannot be null.

getSchemas

public Set<AppSearchSchema> getSchemas ()

Returns the AppSearchSchema types that are part of this request.

Returns
Set<AppSearchSchema> This value cannot be null.

getSchemasNotDisplayedBySystem

public Set<String> getSchemasNotDisplayedBySystem ()

Returns all the schema types that are opted out of being displayed and visible on any system UI surface.

Returns
Set<String> This value cannot be null.

getSchemasVisibleToPackages

public Map<StringSet<PackageIdentifier>> getSchemasVisibleToPackages ()

Returns a mapping of schema types to the set of packages that have access to that schema type.

It’s inefficient to call this method repeatedly.

Returns
Map<StringSet<PackageIdentifier>> This value cannot be null.

getVersion

public int getVersion ()

Returns the database overall schema version.

Returns
int Value is 1 or greater

isForceOverride

public boolean isForceOverride ()

Returns whether this request will force the schema to be overridden.

Returns
boolean