本文整理汇总了Java中com.j256.ormlite.db.DatabaseType.isEntityNamesMustBeUpCase方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseType.isEntityNamesMustBeUpCase方法的具体用法?Java DatabaseType.isEntityNamesMustBeUpCase怎么用?Java DatabaseType.isEntityNamesMustBeUpCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.j256.ormlite.db.DatabaseType
的用法示例。
在下文中一共展示了DatabaseType.isEntityNamesMustBeUpCase方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromDatabaseField
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
public static DatabaseFieldConfig fromDatabaseField(DatabaseType paramDatabaseType, String paramString, Field paramField, DatabaseField paramDatabaseField)
{
DatabaseFieldConfig localDatabaseFieldConfig = new DatabaseFieldConfig();
localDatabaseFieldConfig.fieldName = paramField.getName();
if (paramDatabaseType.isEntityNamesMustBeUpCase())
localDatabaseFieldConfig.fieldName = localDatabaseFieldConfig.fieldName.toUpperCase();
localDatabaseFieldConfig.columnName = valueIfNotBlank(paramDatabaseField.columnName());
localDatabaseFieldConfig.dataType = paramDatabaseField.dataType();
String str = paramDatabaseField.defaultValue();
if (!str.equals("__ormlite__ no default value string was specified"))
localDatabaseFieldConfig.defaultValue = str;
localDatabaseFieldConfig.width = paramDatabaseField.width();
localDatabaseFieldConfig.canBeNull = paramDatabaseField.canBeNull();
localDatabaseFieldConfig.id = paramDatabaseField.id();
localDatabaseFieldConfig.generatedId = paramDatabaseField.generatedId();
localDatabaseFieldConfig.generatedIdSequence = valueIfNotBlank(paramDatabaseField.generatedIdSequence());
localDatabaseFieldConfig.foreign = paramDatabaseField.foreign();
localDatabaseFieldConfig.useGetSet = paramDatabaseField.useGetSet();
localDatabaseFieldConfig.unknownEnumValue = findMatchingEnumVal(paramField, paramDatabaseField.unknownEnumName());
localDatabaseFieldConfig.throwIfNull = paramDatabaseField.throwIfNull();
localDatabaseFieldConfig.format = valueIfNotBlank(paramDatabaseField.format());
localDatabaseFieldConfig.unique = paramDatabaseField.unique();
localDatabaseFieldConfig.uniqueCombo = paramDatabaseField.uniqueCombo();
localDatabaseFieldConfig.index = paramDatabaseField.index();
localDatabaseFieldConfig.indexName = valueIfNotBlank(paramDatabaseField.indexName());
localDatabaseFieldConfig.uniqueIndex = paramDatabaseField.uniqueIndex();
localDatabaseFieldConfig.uniqueIndexName = valueIfNotBlank(paramDatabaseField.uniqueIndexName());
localDatabaseFieldConfig.foreignAutoRefresh = paramDatabaseField.foreignAutoRefresh();
localDatabaseFieldConfig.maxForeignAutoRefreshLevel = paramDatabaseField.maxForeignAutoRefreshLevel();
localDatabaseFieldConfig.persisterClass = paramDatabaseField.persisterClass();
localDatabaseFieldConfig.allowGeneratedIdInsert = paramDatabaseField.allowGeneratedIdInsert();
localDatabaseFieldConfig.columnDefinition = valueIfNotBlank(paramDatabaseField.columnDefinition());
localDatabaseFieldConfig.foreignAutoCreate = paramDatabaseField.foreignAutoCreate();
localDatabaseFieldConfig.version = paramDatabaseField.version();
localDatabaseFieldConfig.foreignColumnName = valueIfNotBlank(paramDatabaseField.foreignColumnName());
return localDatabaseFieldConfig;
}
示例2: clearTable
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
/**
* Clear all data out of the table. For certain database types and with large sized tables, which may take a long
* time. In some configurations, it may be faster to drop and re-create the table.
*
* <p>
* <b>WARNING:</b> This is [obviously] very destructive and is unrecoverable.
* </p>
*/
public static <T> int clearTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException {
String tableName = DatabaseTableConfig.extractTableName(dataClass);
DatabaseType databaseType = connectionSource.getDatabaseType();
if (databaseType.isEntityNamesMustBeUpCase()) {
tableName = databaseType.upCaseEntityName(tableName);
}
return clearTable(connectionSource, tableName);
}
示例3: fromClass
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
/**
* Extract the DatabaseTableConfig for a particular class by looking for class and field annotations. This is used
* by internal classes to configure a class.
*/
public static <T> DatabaseTableConfig<T> fromClass(ConnectionSource connectionSource, Class<T> clazz)
throws SQLException {
String tableName = extractTableName(clazz);
DatabaseType databaseType = connectionSource.getDatabaseType();
if (databaseType.isEntityNamesMustBeUpCase()) {
tableName = databaseType.upCaseEntityName(tableName);
}
return new DatabaseTableConfig<T>(clazz, tableName, extractFieldTypes(connectionSource, clazz, tableName));
}
示例4: fromDatabaseField
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
public static FieldBindings fromDatabaseField(DatabaseType databaseType, Element field, DatabaseField databaseField, Types typeUtils, Messager messager) {
FieldBindings bindings = new FieldBindings();
bindings.fieldName = field.getSimpleName().toString();
if (databaseType.isEntityNamesMustBeUpCase()) {
bindings.fieldName = bindings.fieldName.toUpperCase();
}
bindings.columnName = valueIfNotBlank(databaseField.columnName());
bindings.dataType = databaseField.dataType();
// NOTE: == did not work with the NO_DEFAULT string
String defaultValue = databaseField.defaultValue();
if (!defaultValue.equals(DatabaseField.DEFAULT_STRING)) {
bindings.defaultValue = defaultValue;
}
bindings.width = databaseField.width();
bindings.canBeNull = databaseField.canBeNull();
bindings.id = databaseField.id();
bindings.generatedId = databaseField.generatedId();
bindings.generatedIdSequence = valueIfNotBlank(databaseField.generatedIdSequence());
bindings.foreign = databaseField.foreign();
bindings.useGetSet = databaseField.useGetSet();
bindings.unknownEnumValue = findMatchingEnumVal(field, databaseField.unknownEnumName(), messager);
bindings.throwIfNull = databaseField.throwIfNull();
bindings.format = valueIfNotBlank(databaseField.format());
bindings.unique = databaseField.unique();
bindings.uniqueCombo = databaseField.uniqueCombo();
// add in the index information
bindings.index = databaseField.index();
bindings.indexName = valueIfNotBlank(databaseField.indexName());
bindings.uniqueIndex = databaseField.uniqueIndex();
bindings.uniqueIndexName = valueIfNotBlank(databaseField.uniqueIndexName());
bindings.foreignAutoRefresh = databaseField.foreignAutoRefresh();
bindings.maxForeignAutoRefreshLevel = databaseField.maxForeignAutoRefreshLevel();
try {
databaseField.persisterClass();
} catch (MirroredTypeException e) {
Element element = typeUtils.asElement(e.getTypeMirror());
if (!element.getKind().equals(ElementKind.CLASS)) {
messager.printMessage(Diagnostic.Kind.ERROR, "persisterClass must be a class", element);
return null;
}
bindings.persisterClass = (TypeElement) element;
}
bindings.allowGeneratedIdInsert = databaseField.allowGeneratedIdInsert();
bindings.columnDefinition = valueIfNotBlank(databaseField.columnDefinition());
bindings.foreignAutoCreate = databaseField.foreignAutoCreate();
bindings.version = databaseField.version();
bindings.foreignColumnName = valueIfNotBlank(databaseField.foreignColumnName());
bindings.readOnly = databaseField.readOnly();
return bindings;
}
示例5: fromDatabaseField
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
public static DatabaseFieldConfig fromDatabaseField(DatabaseType databaseType, String tableName, Field field,
DatabaseField databaseField) {
DatabaseFieldConfig config = new DatabaseFieldConfig();
config.fieldName = field.getName();
if (databaseType.isEntityNamesMustBeUpCase()) {
config.fieldName = databaseType.upCaseEntityName(config.fieldName);
}
config.columnName = valueIfNotBlank(databaseField.columnName());
config.dataType = databaseField.dataType();
// NOTE: == did not work with the NO_DEFAULT string
String defaultValue = databaseField.defaultValue();
if (!defaultValue.equals(DatabaseField.DEFAULT_STRING)) {
config.defaultValue = defaultValue;
}
config.width = databaseField.width();
config.canBeNull = databaseField.canBeNull();
config.id = databaseField.id();
config.generatedId = databaseField.generatedId();
config.generatedIdSequence = valueIfNotBlank(databaseField.generatedIdSequence());
config.foreign = databaseField.foreign();
config.useGetSet = databaseField.useGetSet();
config.unknownEnumValue = findMatchingEnumVal(field, databaseField.unknownEnumName());
config.throwIfNull = databaseField.throwIfNull();
config.format = valueIfNotBlank(databaseField.format());
config.unique = databaseField.unique();
config.uniqueCombo = databaseField.uniqueCombo();
// add in the index information
config.index = databaseField.index();
config.indexName = valueIfNotBlank(databaseField.indexName());
config.uniqueIndex = databaseField.uniqueIndex();
config.uniqueIndexName = valueIfNotBlank(databaseField.uniqueIndexName());
config.foreignAutoRefresh = databaseField.foreignAutoRefresh();
if (config.foreignAutoRefresh
|| databaseField.maxForeignAutoRefreshLevel() != DatabaseField.DEFAULT_MAX_FOREIGN_AUTO_REFRESH_LEVEL) {
config.maxForeignAutoRefreshLevel = databaseField.maxForeignAutoRefreshLevel();
} else {
config.maxForeignAutoRefreshLevel = NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED;
}
config.persisterClass = databaseField.persisterClass();
config.allowGeneratedIdInsert = databaseField.allowGeneratedIdInsert();
config.columnDefinition = valueIfNotBlank(databaseField.columnDefinition());
config.foreignAutoCreate = databaseField.foreignAutoCreate();
config.version = databaseField.version();
config.foreignColumnName = valueIfNotBlank(databaseField.foreignColumnName());
config.readOnly = databaseField.readOnly();
config.fullColumnDefinition = valueIfNotBlank(databaseField.fullColumnDefinition());
return config;
}