本文整理匯總了Java中de.greenrobot.dao.query.QueryBuilder.orderAsc方法的典型用法代碼示例。如果您正苦於以下問題:Java QueryBuilder.orderAsc方法的具體用法?Java QueryBuilder.orderAsc怎麽用?Java QueryBuilder.orderAsc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類de.greenrobot.dao.query.QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder.orderAsc方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fetchEntitiesWithPropertiesAndOrder
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
public static <T extends Entity> List<T> fetchEntitiesWithPropertiesAndOrder(Class<T> c, Property whereOrder, int order, Property properties[], Object... values){
if (values == null || properties == null)
throw new NullPointerException("You must have at least one value and one property");
if (values.length != properties.length)
throw new IllegalArgumentException("Values size should match properties size");
QueryBuilder<T> qb = daoSession.queryBuilder(c);
qb.where(properties[0].eq(values[0]));
for (int i = 0 ; i < values.length ; i++)
qb.where(properties[i].eq(values[i]));
if (whereOrder != null && order != -1)
switch (order)
{
case ORDER_ASC:
qb.orderAsc(whereOrder);
break;
case ORDER_DESC:
qb.orderDesc(whereOrder);
break;
}
return qb.list();
}
示例2: fetchEntitiesWithPropertiesAndOrderAndLimit
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
public static <T extends Entity> List<T> fetchEntitiesWithPropertiesAndOrderAndLimit(Class<T> c, int limit, Property whereOrder, int order, Property properties[], Object... values){
if (values == null || properties == null)
throw new NullPointerException("You must have at least one value and one property");
if (values.length != properties.length)
throw new IllegalArgumentException("Values size should match properties size");
QueryBuilder<T> qb = daoSession.queryBuilder(c);
qb.where(properties[0].eq(values[0]));
if (values.length > 1)
for (int i = 0 ; i < values.length ; i++)
qb.where(properties[i].eq(values[i]));
if (whereOrder != null && order != -1)
switch (order)
{
case ORDER_ASC:
qb.orderAsc(whereOrder);
break;
case ORDER_DESC:
qb.orderDesc(whereOrder);
break;
}
if (limit != -1)
qb.limit(limit);
return qb.listLazy();
}
示例3: getList
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
public static List getList(AbstractDao dao, boolean isAsc, Property... orderProperty) {
setIfLog();
QueryBuilder queryBuilder = dao.queryBuilder();
if (isAsc) {
queryBuilder = queryBuilder.orderAsc(orderProperty);
} else {
queryBuilder = queryBuilder.orderDesc(orderProperty);
}
List indexFavList = queryBuilder.list();
return indexFavList;
}
示例4: getList
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
/**
* Executes the query and returns the result as a list containing all entities loaded into memory.
* @param dao
* @param isAsc
* @param orderProperty
* @return
*/
public static List getList(AbstractDao dao, boolean isAsc, Property... orderProperty) {
setIfLog();
QueryBuilder queryBuilder = dao.queryBuilder();
if (isAsc) {
queryBuilder = queryBuilder.orderAsc(orderProperty);
} else {
queryBuilder = queryBuilder.orderDesc(orderProperty);
}
List indexFavList = queryBuilder.list();
return indexFavList;
}
示例5: createList
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
@Override
protected LazyList<Item> createList(Context context) {
QueryBuilder builder = getSession().getItemDao().queryBuilder();
builder.where(builder.or(ItemDao.Properties.Status.eq(Checkable.CHECKED),
ItemDao.Properties.Status.eq(Checkable.UNCHECKED)));
builder.orderAsc(ItemDao.Properties.Name);
return builder.listLazy();
}