当前位置: 首页>>代码示例>>Java>>正文


Java DatabaseType.isEntityNamesMustBeUpCase方法代码示例

本文整理汇总了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;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:38,代码来源:DatabaseFieldConfig.java

示例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);
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:17,代码来源:TableUtils.java

示例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));
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:14,代码来源:DatabaseTableConfig.java

示例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;
}
 
开发者ID:koesie10,项目名称:ormlite-processor,代码行数:52,代码来源:FieldBindings.java

示例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;
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:51,代码来源:DatabaseFieldConfig.java


注:本文中的com.j256.ormlite.db.DatabaseType.isEntityNamesMustBeUpCase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。