public class KittyNamingUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AFTER_CREATE_SCRIPT_FILENAME_PATTERN |
static java.lang.String |
AFTER_MIGRATE_SCRIPT_FILENAME_PATTERN |
static java.lang.String |
ASSETS_URI_START |
static java.lang.String |
CREATE_SCRIPT_FILENAME_PATTERN |
static java.lang.String |
DESERIALIZE |
static java.lang.String |
DROP_SCRIPT_FILENAME_PATTERN |
static java.lang.String |
EXTERNAL_MEM_URI_START |
static java.lang.String |
IA_BAD_URI |
static java.lang.String |
INTERNAL_MEM_URI_START |
Constructor and Description |
---|
KittyNamingUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
generateColumnNameFromModelField(java.lang.reflect.Field f)
Returns default column name generated from
KittyModel field. |
static <T extends KittyDatabase> |
generateSchemaNameFromDatabaseClassName(java.lang.Class<T> kittyDatabaseClass)
Returns default schema name generated from
KittyDatabase implementation classname. |
static <T extends KittyModel> |
generateTableNameFromRecordName(java.lang.Class<T> model)
Returns generated name of table
1) Record and Model endings would be deleted 2) Camel case would be changes to lower_case_underscore |
static java.lang.String |
getAfterCreateScriptDefaultFilename(java.lang.String schemaName,
int schemaVersion)
Returns default filename for schema after create script.
|
static java.lang.String |
getAfterMigrateScriptDefaultFilename(java.lang.String schemaName,
int schemaVersion)
Returns default filename for schema after migrate script.
|
static java.lang.String |
getCreateSchemaDefaultFilename(java.lang.String schemaName,
int schemaVersion)
Returns default filename for schema create script.
|
static java.lang.String |
getDefaultAssetDatabaseScriptsPath(java.lang.String schemaName)
Returns default scripts location for provided database name, output would be:
file:///android_asset/ + kittysqliteorm/database_name/ |
static java.lang.String |
getDefaultDatabaseMigrationScriptsPath(android.content.Context ctx,
java.lang.String schemaName,
boolean scriptsInAssets)
Returns default scripts location for provided database name, output would be:
getFilesDir().getAbsolutePath() + /kittysqliteorm/database_name/version_migrations or file:///android_asset + /kittysqliteorm/database_name/version_migrations |
static java.lang.String |
getDefaultDatabaseScriptsPath(android.content.Context context,
java.lang.String schemaName)
Returns default scripts location for provided database name, output would be:
file:///internal_memory/ + kittysqliteorm/database_name/ that is equivalent for getFilesDir().getAbsolutePath() + /kittysqliteorm/database_name/ |
static java.lang.String |
getDefaultDeserializationMethodName(java.lang.String fieldName)
Returns default serialization name for provided field name.
|
static java.lang.String |
getDefaultSerializationMethodName(java.lang.String fieldName)
Returns default serialization name for provided field name.
|
static java.lang.String |
getDevelopmentDumpsDefaultPath(java.lang.String scriptRootPath,
java.lang.String scriptName)
Returns filepath for development create\drop scripts (or other if necessary) for specified scripts root.
|
static java.lang.String |
getDropSchemaDefaultFilename(java.lang.String schemaName,
int schemaVersion)
Returns default filename for schema drop script.
|
static java.io.File |
getScriptFile(java.lang.String locationUri,
android.content.Context ctx)
Returns script file instance depends on locationUri value (if locationUri starts
with
ASSETS_URI_START IA exception would be thrown) |
static java.lang.String |
getSQLiteScriptPath(java.lang.String scriptRootPath,
java.lang.String scriptName)
Returns filepath for create\drop scripts for specified scripts root.
|
public static final java.lang.String ASSETS_URI_START
public static final java.lang.String INTERNAL_MEM_URI_START
public static final java.lang.String EXTERNAL_MEM_URI_START
public static final java.lang.String CREATE_SCRIPT_FILENAME_PATTERN
public static final java.lang.String DROP_SCRIPT_FILENAME_PATTERN
public static final java.lang.String AFTER_CREATE_SCRIPT_FILENAME_PATTERN
public static final java.lang.String AFTER_MIGRATE_SCRIPT_FILENAME_PATTERN
public static final java.lang.String DESERIALIZE
public static final java.lang.String IA_BAD_URI
public static final <T extends KittyDatabase> java.lang.String generateSchemaNameFromDatabaseClassName(java.lang.Class<T> kittyDatabaseClass)
KittyDatabase
implementation classname.
KittyUtils.fieldNameToLowerCaseUnderScore(String)
T
- kittyDatabaseClass
- public static final java.lang.String generateColumnNameFromModelField(java.lang.reflect.Field f)
KittyModel
field.
KittyUtils.fieldNameToLowerCaseUnderScore(String)
f
- public static final java.lang.String getDefaultAssetDatabaseScriptsPath(java.lang.String schemaName)
schemaName
- public static final java.io.File getScriptFile(java.lang.String locationUri, android.content.Context ctx)
ASSETS_URI_START
IA exception would be thrown)locationUri
- ctx
- public static final java.lang.String getDefaultDatabaseScriptsPath(android.content.Context context, java.lang.String schemaName)
context
- schemaName
- public static final java.lang.String getDefaultDatabaseMigrationScriptsPath(android.content.Context ctx, java.lang.String schemaName, boolean scriptsInAssets)
ctx
- schemaName
- public static final java.lang.String getCreateSchemaDefaultFilename(java.lang.String schemaName, int schemaVersion)
schemaName
- schemaVersion
- public static final java.lang.String getDropSchemaDefaultFilename(java.lang.String schemaName, int schemaVersion)
schemaName
- schemaVersion
- public static final java.lang.String getAfterCreateScriptDefaultFilename(java.lang.String schemaName, int schemaVersion)
schemaName
- schemaVersion
- public static final java.lang.String getAfterMigrateScriptDefaultFilename(java.lang.String schemaName, int schemaVersion)
schemaName
- schemaVersion
- public static final java.lang.String getSQLiteScriptPath(java.lang.String scriptRootPath, java.lang.String scriptName)
scriptRootPath
- scriptName
- public static final java.lang.String getDevelopmentDumpsDefaultPath(java.lang.String scriptRootPath, java.lang.String scriptName)
scriptRootPath
- scriptName
- public static final java.lang.String getDefaultSerializationMethodName(java.lang.String fieldName)
fieldName
- public static final java.lang.String getDefaultDeserializationMethodName(java.lang.String fieldName)
fieldName
- public static final <T extends KittyModel> java.lang.String generateTableNameFromRecordName(java.lang.Class<T> model)
T
- implementation of KittyModel
model
- model class