Package io.nevernull.mobileui.ormlite
Class OrmLiteConfiguration
- java.lang.Object
-
- io.nevernull.mobileui.ormlite.OrmLiteConfiguration
-
public class OrmLiteConfiguration extends Object
Config → Cross-Platform configuration for OrmLite. To create a new configuration, start withOrmLiteConfiguration.entities(...)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OrmLiteConfiguration
autoCreateTables(boolean autoCreate)
Optionally alter the behavior to NOT automatically create tables for all entities by setting this featrue tofalse
.static OrmLiteConfiguration
entities(Class<?>... entityClasses)
Creates a new configuration for the given list of entity classes.OnCreateListener
getCreateListener()
Gets create listener.int
getDatabaseVersion()
Gets database version.OnUpgradeListener
getUpgradeListener()
Gets upgrade listener.boolean
isAutoCreateTables()
Is auto create tables boolean.OrmLiteConfiguration
name(String name)
Optionally set the database simple file name (default: database.db).OrmLiteConfiguration
onCreate(OnCreateListener listener)
Optionally set a listener to react to the database being newly created.OrmLiteConfiguration
onUpgrade(OnUpgradeListener listener)
Optionally set a listener to react to database upgrades (your version being higher than the given database user version).String
toString()
OrmLiteConfiguration
version(int version)
Optionally set the database user version for upgrade handling (default: 1)
-
-
-
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 tofalse
.- 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
-
-