public class BaseStore
extends java.lang.Object
EntityStore
.Modifier and Type | Field and Description |
---|---|
protected android.content.Context |
context
The context of the host application.
|
protected io.requery.reactivex.ReactiveEntityStore<io.requery.Persistable> |
dataStore
Reference to the data store.
|
static int |
MAX_SQL_EXPRESSIONS
The maximum of expressions allowed in the queries generation by this store.
|
static int |
MAX_SQL_VARIABLES
The maximum of variables allowed in the queries generation by this store.
|
protected com.brightcove.player.store.BaseStore.Source |
source
Reference to the backing store configuration.
|
Modifier | Constructor and Description |
---|---|
protected |
BaseStore(android.content.Context context,
io.requery.meta.EntityModel model,
int version)
Constructs a new instance of
BaseStore |
protected |
BaseStore(android.content.Context context,
io.requery.meta.EntityModel model,
java.lang.String name,
int version)
Constructs a new instance of
BaseStore |
Modifier and Type | Method and Description |
---|---|
boolean |
compact()
Compacts the physical database file size by running the SQLite
VACUUM statement.
|
boolean |
deleteEntity(IdentifiableEntity entity)
Deletes an identifiable entity from the store.
|
protected static java.lang.String |
getDefaultDatabaseName(android.content.Context context,
io.requery.meta.EntityModel model)
Provides the default database name for the given application context/entity model.
|
protected static java.lang.String |
getDefaultDatabasePassword(android.content.Context context,
io.requery.meta.EntityModel model)
Provides the default database password for the given application context/entity model.
|
long |
getFileSize()
Gets the size of the backing database file.
|
protected void |
onCreated(int version)
Called when new
EntityDataStore has been created. |
protected void |
onUpgraded(int oldVersion,
int newVersion)
Called when the
EntityDataStore has been upgraded from an previous version
to a new version. |
<E extends IdentifiableEntity> |
refreshEntity(E entity)
Refresh the given entity.
|
<T extends IdentifiableEntity> |
saveEntity(T entity)
Inserts or updates the given entity.
|
public static final int MAX_SQL_VARIABLES
public static final int MAX_SQL_EXPRESSIONS
protected final android.content.Context context
protected final com.brightcove.player.store.BaseStore.Source source
protected final io.requery.reactivex.ReactiveEntityStore<io.requery.Persistable> dataStore
protected BaseStore(@NonNull android.content.Context context, @NonNull io.requery.meta.EntityModel model, int version)
BaseStore
context
- reference to the host application context.model
- the entity modelversion
- the schema versionprotected BaseStore(@NonNull android.content.Context context, @NonNull io.requery.meta.EntityModel model, @NonNull java.lang.String name, int version)
BaseStore
context
- reference to the host application context.model
- the entity modelname
- the name of the databaseversion
- the schema versionpublic long getFileSize()
public boolean compact()
@Nullable public <E extends IdentifiableEntity> E refreshEntity(@Nullable E entity)
E
- the expected type of the entity;entity
- reference to the entity to be refreshed.protected void onCreated(int version)
EntityDataStore
has been created. Override this method to setup
the default state of the entity store.version
- schema version of the store.protected void onUpgraded(int oldVersion, int newVersion)
EntityDataStore
has been upgraded from an previous version
to a new version.oldVersion
- the old schema versionnewVersion
- the new schema versionpublic <T extends IdentifiableEntity> T saveEntity(@NonNull T entity)
entity
- the entity to be save.public boolean deleteEntity(@Nullable IdentifiableEntity entity)
entity
- the entity to be deleted.protected static java.lang.String getDefaultDatabaseName(android.content.Context context, io.requery.meta.EntityModel model)
context
- the context of the host application.model
- reference to the entity model.@Nullable protected static java.lang.String getDefaultDatabasePassword(android.content.Context context, io.requery.meta.EntityModel model)
context
- the context of the host application.model
- reference to the entity model.