public class Options extends Object
KvStore.
You can determine whether to create another database if a KvStore database is missing,
whether to encrypt the database, and the database type.
SystemCapability.Data#DATA_DISTRIBUTEDDATAMGR| 构造器 | 说明 |
|---|---|
Options() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
KvStoreType |
getKvStoreType() |
Obtains the
KvStore database type. |
Schema |
getSchema() |
Obtains the
Schema from this Options object. |
SecurityLevel |
getSecurityLevel() |
Obtains the
KvStore database security level. |
boolean |
isAutoSync() |
Checks whether this
KvStore is automatically synchronized with the KvStore of other devices. |
boolean |
isBackup() |
Checks whether this
KvStore can be backed up. |
boolean |
isCreateIfMissing() |
Checks whether a
KvStore database can be created if no KvStore database is available. |
boolean |
isEncrypt() |
Checks whether the
KvStore database is encrypted. |
Options |
setAutoSync(boolean isAutoSync) |
Sets whether to automatically synchronize this
KvStore with the KvStore of other devices. |
Options |
setBackup(boolean isBackup) |
Sets whether to enable backup of this
KvStore. |
Options |
setCreateIfMissing(boolean isCreateIfMissing) |
Sets whether to create a
KvStore database if no KvStore database is available. |
Options |
setEncrypt(boolean isEncrypt) |
Sets whether to encrypt the
KvStore database. |
Options |
setKvStoreType(KvStoreType kvStoreType) |
Sets the type of the
KvStore database. |
Options |
setSchema(Schema schema) |
Sets the
Schema for this Options object. |
Options |
setSecurityLevel(SecurityLevel securityLevel) |
Sets the type of the
KvStore database. |
public boolean isCreateIfMissing()
KvStore database can be created if no KvStore database is available.true if a KvStore database can be created if no KvStore
database is available; returns false otherwise.public Options setCreateIfMissing(boolean isCreateIfMissing)
KvStore database if no KvStore database is available.isCreateIfMissing - Specifies whether to create a KvStore database if no KvStore
database is available. The value true means to create a KvStore database if
no KvStore database is available, and false means the opposite.Options object.public boolean isEncrypt()
KvStore database is encrypted.true if the database is encrypted; returns false otherwise.public Options setEncrypt(boolean isEncrypt)
KvStore database.isEncrypt - Specifies whether to encrypt the KvStore database. The value true
means to encrypt the KvStore database, and false means not to encrypt
the KvStore database.Options object.public boolean isBackup()
KvStore can be backed up.true if this KvStore can be backed up; returns false otherwise.public Options setBackup(boolean isBackup)
KvStore.isBackup - Specifies whether to enable backup of this KvStore. The value true means
to enable backup of this KvStore, and false means to disable backup of this KvStore.Options object.public boolean isAutoSync()
KvStore is automatically synchronized with the KvStore of other devices.
This method applies only to DeviceKvStore and SingleKvStore.
true if this KvStore is automatically synchronized with the KvStore of
other devices; returns false otherwise.public Options setAutoSync(boolean isAutoSync)
KvStore with the KvStore of other devices.
This method applies only to DeviceKvStore and SingleKvStore.
isAutoSync - Specifies whether to automatically synchronize this KvStore with the KvStore
of other devices. The value true means to automatically synchronize this KvStore with the
KvStore of other devices, and false means the opposite.Options object.public KvStoreType getKvStoreType()
KvStore database type.0 for SingleKvStore, 1 for MultiKvStore, and 2 for
DeviceKvStore, as enumerated in KvStoreType.public Options setKvStoreType(KvStoreType kvStoreType)
KvStore database.kvStoreType - Indicates the KvStore type, as enumerated in KvStoreType.Options object.public Schema getSchema()
Schema from this Options object.Schema.public Options setSchema(Schema schema)
Schema for this Options object.
After the Schema is set, the database will be created or opened as a schema database.
schema - Indicates the Schema to set.Options object with the Schema set.public SecurityLevel getSecurityLevel()
KvStore database security level.KvStore database security level. as enumerated in SecurityLevel.public Options setSecurityLevel(SecurityLevel securityLevel)
KvStore database.securityLevel - Indicates the KvStore security level, as enumerated in SecurityLevel.Options object.