Class OrmLiteConfiguration


  • public class OrmLiteConfiguration
    extends Object
    Config → Cross-Platform configuration for OrmLite. To create a new configuration, start with OrmLiteConfiguration.entities(...)
    • Method Detail

      • getDatabaseVersion

        public int getDatabaseVersion()
        Gets database version.
        Returns:
        the database version
      • entities

        @Nonnull
        public static OrmLiteConfiguration entities​(@Nonnull
                                                    Class<?>... entityClasses)
        Creates a new configuration for the given list of entity classes.
        Parameters:
        entityClasses - the entity classes
        Returns:
        the orm lite configuration
      • version

        @Nonnull
        public OrmLiteConfiguration version​(int version)
        Optionally set the database user version for upgrade handling (default: 1)
        Parameters:
        version - the database user version
        Returns:
        the orm lite configuration
      • name

        @Nonnull
        public OrmLiteConfiguration name​(@Nonnull
                                         String name)
        Optionally set the database simple file name (default: database.db). The database will be created within the platform's default database path of your app.
        Parameters:
        name - the simple file name of your database
        Returns:
        the orm lite configuration
      • onCreate

        @Nonnull
        public OrmLiteConfiguration onCreate​(@Nonnull
                                             OnCreateListener listener)
        Optionally set a listener to react to the database being newly created. By default, the tables for all entities will be created. You can disable this with the autoCreate feature, if you like.
        Parameters:
        listener - the listener
        Returns:
        the orm lite configuration
      • onUpgrade

        @Nonnull
        public OrmLiteConfiguration onUpgrade​(@Nonnull
                                              OnUpgradeListener listener)
        Optionally set a listener to react to database upgrades (your version being higher than the given database user version). By default, the component does nothing but set the user version to the higher one given via this config.
        Parameters:
        listener - the listener
        Returns:
        the orm lite configuration
      • autoCreateTables

        @Nonnull
        public OrmLiteConfiguration autoCreateTables​(boolean autoCreate)
        Optionally alter the behavior to NOT automatically create tables for all entities by setting this featrue to false.
        Parameters:
        autoCreate - the auto create
        Returns:
        the orm lite configuration
      • getCreateListener

        public OnCreateListener getCreateListener()
        Gets create listener.
        Returns:
        the create listener
      • getUpgradeListener

        public OnUpgradeListener getUpgradeListener()
        Gets upgrade listener.
        Returns:
        the upgrade listener
      • isAutoCreateTables

        public boolean isAutoCreateTables()
        Is auto create tables boolean.
        Returns:
        the boolean