com.psddev.dari.db.Query.setSorters()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中com.psddev.dari.db.Query.setSorters方法的一些代码示例,展示了Query.setSorters的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setSorters方法的具体详情如下:
包路径:com.psddev.dari.db.Query
类名称:Query
方法名:setSorters

Query.setSorters介绍

[英]Sets the list of sorters applied to the result.
[中]设置应用于结果的分类器列表。

代码示例

代码示例来源:origin: perfectsense/brightspot-cms

  1. private void addLegacyDatabaseSupport(Query query) {
  2. boolean usesLegacyDatabase = false;
  3. Database database = query.getDatabase();
  4. while (database instanceof ForwardingDatabase) {
  5. database = ((ForwardingDatabase) database).getDelegate();
  6. }
  7. if (database instanceof SqlDatabase) {
  8. usesLegacyDatabase = true;
  9. } else if (database instanceof AggregateDatabase) {
  10. usesLegacyDatabase = ((AggregateDatabase) database).getDelegatesByClass(SqlDatabase.class).size() > 0;
  11. }
  12. if (usesLegacyDatabase) {
  13. query.getOptions().put(SqlDatabase.USE_JDBC_FETCH_SIZE_QUERY_OPTION, false);
  14. query.setSorters(null); // SqlDatabase#ByIdIterator does not support sorters
  15. }
  16. }

代码示例来源:origin: perfectsense/dari

  1. @Override
  2. public Query<E> clone() {
  3. Query<E> clone = new Query<E>(group, objectClass);
  4. clone.setPredicate(predicate);
  5. clone.setSorters(sorters != null ? new ArrayList<Sorter>(sorters) : null);
  6. clone.setFields(fields != null ? new ArrayList<String>(fields) : null);
  7. clone.setDatabase(database);
  8. clone.setResolveToReferenceOnly(isResolveToReferenceOnly);
  9. clone.setCache(!noCache);
  10. clone.setMaster(master);
  11. clone.setResolveInvisible(resolveInvisible);
  12. clone.setTimeout(timeout);
  13. clone.setOptions(options != null ? new HashMap<String, Object>(options) : null);
  14. return clone;
  15. }

相关文章