本文整理匯總了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();
}