# Print output for @column tags ?>
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:
AppSearchSchema
types
AppSearchSchema
type
The following types of schema changes are not backwards compatible:
AppSearchSchema
type
AppSearchSchema
type
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 :
SetSchemaRequest.Builder#setForceOverride
method to true
. This
deletes all documents that are incompatible with the new schema. The new schema is then
saved and persisted to disk.
Migrator
for each incompatible type and make no deletion. The migrator will
migrate documents from it's old schema version to the new version. Migrated types will be
set into both SetSchemaResponse#getIncompatibleTypes()
and SetSchemaResponse.getMigratedTypes()
. See the migration section below.
Nested classes | |
---|---|
class |
SetSchemaRequest.Builder
Builder for |
Public methods | |
---|---|
Map<String, Migrator>
|
getMigrators()
Returns the map of |
Set<AppSearchSchema>
|
getSchemas()
Returns the |
Set<String>
|
getSchemasNotDisplayedBySystem()
Returns all the schema types that are opted out of being displayed and visible on any system UI surface. |
Map<String, Set<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 Map<String, Migrator> getMigrators ()
Returns the map of Migrator
, the key will be the schema type of the Migrator
associated with.
Returns | |
---|---|
Map<String, Migrator> |
This value cannot be null . |
public Set<AppSearchSchema> getSchemas ()
Returns the AppSearchSchema
types that are part of this request.
Returns | |
---|---|
Set<AppSearchSchema> |
This value cannot be null . |
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 . |
public Map<String, Set<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<String, Set<PackageIdentifier>> |
This value cannot be null . |
public int getVersion ()
Returns the database overall schema version.
Returns | |
---|---|
int |
Value is 1 or greater |
public boolean isForceOverride ()
Returns whether this request will force the schema to be overridden.
Returns | |
---|---|
boolean |