當前位置: 首頁>>代碼示例>>Java>>正文


Java DatabaseTable類代碼示例

本文整理匯總了Java中com.j256.ormlite.table.DatabaseTable的典型用法代碼示例。如果您正苦於以下問題:Java DatabaseTable類的具體用法?Java DatabaseTable怎麽用?Java DatabaseTable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DatabaseTable類屬於com.j256.ormlite.table包,在下文中一共展示了DatabaseTable類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTableName

import com.j256.ormlite.table.DatabaseTable; //導入依賴的package包/類
/**
 * Get the SQLite table name for an OrmLite model.
 *
 * @param annotationRetriever the annotation retriever that caches the annotations
 * @param modelClass          an OrmLite model class annotated with {@link DatabaseTable}
 * @return the SQLite table name
 */
public static String getTableName(AnnotationRetriever annotationRetriever, Class<?> modelClass) {
	DatabaseTable table_annotation = annotationRetriever.getAnnotation(modelClass, DatabaseTable.class);

	if (table_annotation == null) {
		throw new RuntimeException("DatabaseTable annotation not found for " + modelClass.getName());
	}

	return getTableName(modelClass, table_annotation);
}
 
開發者ID:ByteWelder,項目名稱:Poetry,代碼行數:17,代碼來源:OrmliteReflection.java

示例2: 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;
}
 
開發者ID:lujianzhao,項目名稱:AndroidBase,代碼行數:21,代碼來源:DatabaseUtil.java

示例3: 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;
}
 
開發者ID:koesie10,項目名稱:ormlite-processor,代碼行數:12,代碼來源:AnnotationProcessor.java

示例4: classHasAnnotations

import com.j256.ormlite.table.DatabaseTable; //導入依賴的package包/類
private static boolean classHasAnnotations(Class<?> paramClass)
{
  while (paramClass != null)
  {
    if (paramClass.getAnnotation(DatabaseTable.class) != null)
      return true;
    Field[] arrayOfField;
    try
    {
      arrayOfField = paramClass.getDeclaredFields();
    }
    catch (Throwable localThrowable1)
    {
      System.err.println("Could not load get delcared fields from: " + paramClass);
      System.err.println("     " + localThrowable1);
      return false;
    }
    int i = arrayOfField.length;
    for (int j = 0; j < i; j++)
    {
      Field localField = arrayOfField[j];
      if ((localField.getAnnotation(DatabaseField.class) != null) || (localField.getAnnotation(ForeignCollectionField.class) != null))
        return true;
    }
    try
    {
      paramClass = paramClass.getSuperclass();
    }
    catch (Throwable localThrowable2)
    {
      System.err.println("Could not get super class for: " + paramClass);
      System.err.println("     " + localThrowable2);
      return false;
    }
  }
  return false;
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:38,代碼來源:OrmLiteConfigUtil.java

示例5: getSupportedAnnotationTypes

import com.j256.ormlite.table.DatabaseTable; //導入依賴的package包/類
@Override
public Set<String> getSupportedAnnotationTypes() {
    Set<String> annotations = new LinkedHashSet<String>();
    annotations.add(DatabaseTable.class.getCanonicalName());
    return annotations;
}
 
開發者ID:koesie10,項目名稱:ormlite-processor,代碼行數:7,代碼來源:AnnotationProcessor.java

示例6: 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();
}
 
開發者ID:Shockah,項目名稱:Skylark,代碼行數:5,代碼來源:DatabaseManager.java

示例7: getLastServerTimestamp

import com.j256.ormlite.table.DatabaseTable; //導入依賴的package包/類
private <T extends Entity> long getLastServerTimestamp(Class<T> clazz) throws SQLException {
    String tableName = clazz.getAnnotation(DatabaseTable.class).tableName();
    if(tableName.isEmpty())
        tableName = clazz.getSimpleName().toLowerCase();
    return mPersistContext.getEntityDao(clazz).queryRawValue("select ifnull(max(last_modified), 0) from " + tableName);
}
 
開發者ID:Adonai,項目名稱:WalletMaster,代碼行數:7,代碼來源:SyncStateMachine.java

示例8: persistArrayOfBaseTypes

import com.j256.ormlite.table.DatabaseTable; //導入依賴的package包/類
private List<Object> persistArrayOfBaseTypes(Class<?> modelClass, JSONArray jsonArray, ForeignCollectionFieldSingleTarget singleTargetField) throws JSONException {
	DatabaseTable table_annotation = modelClass.getAnnotation(DatabaseTable.class);

	if (table_annotation == null) {
		throw new RuntimeException("DatabaseTable annotation not found for " + modelClass.getName());
	}

	String table_name = OrmliteReflection.getTableName(modelClass, table_annotation);

	List<Object> results = new ArrayList<>(jsonArray.length());

	for (int i = 0; i < jsonArray.length(); i++) {
		Object value_object = jsonArray.get(i);

		ContentValues content_values = new ContentValues();
		content_values.put(singleTargetField.targetField(), value_object.toString());

		long inserted_id = database.insert("'" + table_name + "'", singleTargetField.targetField(), content_values);

		if (inserted_id == -1) {
			throw new SQLiteException("failed to insert " + modelClass.getName());
		}

		results.add(inserted_id);
	}

	return results;
}
 
開發者ID:ByteWelder,項目名稱:Poetry,代碼行數:29,代碼來源:JsonPersister.java

示例9: propertyInclusion

import com.j256.ormlite.table.DatabaseTable; //導入依賴的package包/類
@Override
public void propertyInclusion(JDefinedClass clazz, JsonNode schema) {
   clazz.annotate(DatabaseTable.class).param("tableName", schema.get("table").asText());
   
    
}
 
開發者ID:othreecodes,項目名稱:APX,代碼行數:7,代碼來源:ORMLiteAnotator.java


注:本文中的com.j256.ormlite.table.DatabaseTable類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。