StorageDomain.Database


public final class StorageDomain.Database extends StorageDomain


Targets structured SQLite/Room database records.

Summary

Public constructors

Database(
    @NonNull String dbName,
    @NonNull String table,
    @NonNull String primaryKeyCol,
    @NonNull Object primaryKeyVal,
    @NonNull Map<@NonNull String, Object> columnValues,
    boolean isDeviceProtectedStorage
)

Public methods

boolean
equals(Object other)
final @NonNull Map<@NonNull String, Object>

A non-empty Map of column names to their values to populate or verify.

final @NonNull String

The name of the SQLite database file on the device.

final @NonNull String

The column name of the primary key used to identify the target record.

final @NonNull Object

The value of the primary key used to identify the target record.

final @NonNull String

The target table name to insert into or query from.

int
final boolean

Whether the database is in device-protected storage, which is available before the user first unlocks the device, rather than in the default storage of the app.

@NonNull String

Public constructors

Database

public Database(
    @NonNull String dbName,
    @NonNull String table,
    @NonNull String primaryKeyCol,
    @NonNull Object primaryKeyVal,
    @NonNull Map<@NonNull String, Object> columnValues,
    boolean isDeviceProtectedStorage
)

Public methods

equals

public boolean equals(Object other)

getColumnValues

Added in 1.0.0-alpha04
public final @NonNull Map<@NonNull String, Object> getColumnValues()

A non-empty Map of column names to their values to populate or verify. Supported types are: String, Int, Long, Float, Double, Boolean, or null, which stands for SQL NULL. It may include primaryKeyCol, matched case-insensitively like SQLite column names, but only with a value whose string form equals that of primaryKeyVal; otherwise construction fails with an IllegalArgumentException. When it is omitted, primaryKeyVal is written to that column. The domain keeps a copy of it.

getDbName

Added in 1.0.0-alpha04
public final @NonNull String getDbName()

The name of the SQLite database file on the device.

getPrimaryKeyCol

Added in 1.0.0-alpha04
public final @NonNull String getPrimaryKeyCol()

The column name of the primary key used to identify the target record.

getPrimaryKeyVal

Added in 1.0.0-alpha04
public final @NonNull Object getPrimaryKeyVal()

The value of the primary key used to identify the target record. Supported types are: String, Int, Long, Float, Double, Boolean.

getTable

Added in 1.0.0-alpha04
public final @NonNull String getTable()

The target table name to insert into or query from.

hashCode

public int hashCode()

isDeviceProtectedStorage

Added in 1.0.0-alpha04
public final boolean isDeviceProtectedStorage()

Whether the database is in device-protected storage, which is available before the user first unlocks the device, rather than in the default storage of the app. That is credential-encrypted storage, unless the app sets android:defaultToDeviceProtectedStorage.

toString

public @NonNull String toString()