Class Database

  • All Implemented Interfaces:
    Streamable

    public class Database
    extends Object
    implements Streamable
    Represents the database in a Room SQLite database schema. This will generally be read from a JSON file with the structure described in Parser.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      List<Entity> getEntities()
      Returns the List of Entity instances representing the tables in the database schema, corresponding to the database.entities JSON property.
      int getVersion()
      Returns the int-valued version number of the database schema, as declared in the version attribute of the @Database annotation, and serialized as the database.version property in the JSON schema.
      List<View> getViews()
      Returns the List of View instances representing the views in the database schema, corresponding to the database.views JSON property.The latter correspond, in turn, to the @DatabaseView-annotated classes included in the views property of a @Database-annotated class.
      void setEntities​(List<Entity> entities)
      Sets the List of Entity instances representing the tables in the database schema.
      void setVersion​(int version)
      Sets the version number of the database schema.
      void setViews​(List<View> views)
      Sets the List of View instances representing the views in the database schema.
      Stream<String> stream()
      Gathers into a Stream and returns the DDL statements capable of creating the database corresponding to this instance, along with all of its tables, indices, and views.
    • Method Detail

      • getEntities

        public List<Entity> getEntities()
        Returns the List of Entity instances representing the tables in the database schema, corresponding to the database.entities JSON property. The latter correspond, in turn, to the @Entity-annotated classes included in the entities property of a @Database-annotated class.
      • setEntities

        public void setEntities​(List<Entity> entities)
        Sets the List of Entity instances representing the tables in the database schema.
        Parameters:
        entities -
      • getViews

        public List<View> getViews()
        Returns the List of View instances representing the views in the database schema, corresponding to the database.views JSON property.The latter correspond, in turn, to the @DatabaseView-annotated classes included in the views property of a @Database-annotated class.
      • setViews

        public void setViews​(List<View> views)
        Sets the List of View instances representing the views in the database schema.
        Parameters:
        views -
      • getVersion

        public int getVersion()
        Returns the int-valued version number of the database schema, as declared in the version attribute of the @Database annotation, and serialized as the database.version property 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 a Stream and returns the DDL statements capable of creating the database corresponding to this instance, along with all of its tables, indices, and views.
        Specified by:
        stream in interface Streamable