本文整理匯總了Java中com.activeandroid.annotation.Table類的典型用法代碼示例。如果您正苦於以下問題:Java Table類的具體用法?Java Table怎麽用?Java Table使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Table類屬於com.activeandroid.annotation包,在下文中一共展示了Table類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: TableInfo
import com.activeandroid.annotation.Table; //導入依賴的package包/類
public TableInfo(Class<? extends Model> type) {
mType = type;
final Table tableAnnotation = type.getAnnotation(Table.class);
if (tableAnnotation != null) {
mTableName = tableAnnotation.name();
mIdName = tableAnnotation.id();
}
else {
mTableName = type.getSimpleName();
}
// Manually add the id column since it is not declared like the other columns.
Field idField = getIdField(type);
mColumnNames.put(idField, mIdName);
List<Field> fields = new LinkedList<Field>(ReflectionUtils.getDeclaredColumnFields(type));
Collections.reverse(fields);
for (Field field : fields) {
if (field.isAnnotationPresent(Column.class)) {
final Column columnAnnotation = field.getAnnotation(Column.class);
String columnName = columnAnnotation.name();
if (TextUtils.isEmpty(columnName)) {
columnName = field.getName();
}
mColumnNames.put(field, columnName);
}
}
}
示例2: getCart
import com.activeandroid.annotation.Table; //導入依賴的package包/類
public synchronized List<Cart> getCart(long id) {
try {
return new Select().from(Cart.class).where(Table.DEFAULT_ID_NAME + " = ?", id).execute();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
示例3: getAddress
import com.activeandroid.annotation.Table; //導入依賴的package包/類
public synchronized Address getAddress(long id) {
try {
return new Select().from(Address.class).where(Table.DEFAULT_ID_NAME + " = ?", id).executeSingle();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}