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


Java QueryBuilder.orderAsc方法代碼示例

本文整理匯總了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();
    }
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:29,代碼來源:DaoCore.java

示例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();
    }
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:33,代碼來源:DaoCore.java

示例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;
}
 
開發者ID:DroidKOF,項目名稱:pineapple,代碼行數:12,代碼來源:GreenDaoUtils.java

示例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;
}
 
開發者ID:cymcsg,項目名稱:UltimateAndroid,代碼行數:19,代碼來源:GreenDaoUtils.java

示例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();
}
 
開發者ID:dsoulayrol,項目名稱:android-sholi,代碼行數:9,代碼來源:CheckingFragment.java


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