Package com.nickbenn.room.model
Class Database
- java.lang.Object
-
- com.nickbenn.room.model.Database
-
- All Implemented Interfaces:
Streamable
public class Database extends Object implements Streamable
Represents thedatabasein a Room SQLite database schema. This will generally be read from a JSON file with the structure described inParser.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Entity>getEntities()intgetVersion()Returns theint-valued version number of the database schema, as declared in theversionattribute of the@Databaseannotation, and serialized as thedatabase.versionproperty in the JSON schema.List<View>getViews()voidsetEntities(List<Entity> entities)voidsetVersion(int version)Sets the version number of the database schema.voidsetViews(List<View> views)Stream<String>stream()Gathers into aStreamand returns the DDL statements capable of creating the database corresponding to this instance, along with all of its tables, indices, and views.
-
-
-
Method Detail
-
getVersion
public int getVersion()
Returns theint-valued version number of the database schema, as declared in theversionattribute of the@Databaseannotation, and serialized as thedatabase.versionproperty in the JSON schema.
-
setVersion
public void setVersion(int version)
Sets the version number of the database schema.- Parameters:
version-
-
stream
public Stream<String> stream()
Gathers into aStreamand returns the DDL statements capable of creating the database corresponding to this instance, along with all of its tables, indices, and views.- Specified by:
streamin interfaceStreamable
-
-