本文整理汇总了Java中com.j256.ormlite.table.DatabaseTable.tableName方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseTable.tableName方法的具体用法?Java DatabaseTable.tableName怎么用?Java DatabaseTable.tableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.j256.ormlite.table.DatabaseTable
的用法示例。
在下文中一共展示了DatabaseTable.tableName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractTableName
import com.j256.ormlite.table.DatabaseTable; //导入方法依赖的package包/类
/**
* 获取表名
*
* @param clazz 表的实体bean
* @param <T>
* @return
*/
public static <T> String extractTableName(Class<T> clazz) {
DatabaseTable databaseTable = clazz.getAnnotation(DatabaseTable.class);
String name;
if (databaseTable != null && !Check.isEmpty(databaseTable.tableName())) {
name = databaseTable.tableName();
} else {
name =new JavaxPersistenceImpl().getEntityName(clazz);
if (name == null) {
name = clazz.getSimpleName().toLowerCase();
}
}
return name;
}
示例2: extractTableName
import com.j256.ormlite.table.DatabaseTable; //导入方法依赖的package包/类
private static String extractTableName(TypeElement element) {
DatabaseTable databaseTable = element.getAnnotation(DatabaseTable.class);
String name;
if (databaseTable != null && databaseTable.tableName() != null && databaseTable.tableName().length() > 0) {
name = databaseTable.tableName();
} else {
// if the name isn't specified, it is the class name lowercased
name = element.getSimpleName().toString().toLowerCase();
}
return name;
}
示例3: getDatabaseTable
import com.j256.ormlite.table.DatabaseTable; //导入方法依赖的package包/类
private <T extends DbObject<T>> String getDatabaseTable(Class<T> clazz) {
DatabaseTable databaseTable = clazz.getAnnotation(DatabaseTable.class);
return databaseTable == null ? clazz.getSimpleName().toLowerCase() : databaseTable.tableName();
}
示例4: getTableName
import com.j256.ormlite.table.DatabaseTable; //导入方法依赖的package包/类
/**
* Get the SQLite table name for an OrmLite model.
*
* @param modelClass an OrmLite model class annotated with {@link DatabaseTable}
* @param tableAnnotation the annotation to process
* @return the SQLite table name
*/
public static String getTableName(Class<?> modelClass, DatabaseTable tableAnnotation) {
return !tableAnnotation.tableName().isEmpty() ? tableAnnotation.tableName() : modelClass.getSimpleName();
}