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

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

本文整理了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

private void addLegacyDatabaseSupport(Query query) {
  boolean usesLegacyDatabase = false;
  Database database = query.getDatabase();
  while (database instanceof ForwardingDatabase) {
    database = ((ForwardingDatabase) database).getDelegate();
  }
  if (database instanceof SqlDatabase) {
    usesLegacyDatabase = true;
  } else if (database instanceof AggregateDatabase) {
    usesLegacyDatabase = ((AggregateDatabase) database).getDelegatesByClass(SqlDatabase.class).size() > 0;
  }
  if (usesLegacyDatabase) {
    query.getOptions().put(SqlDatabase.USE_JDBC_FETCH_SIZE_QUERY_OPTION, false);
    query.setSorters(null); // SqlDatabase#ByIdIterator does not support sorters
  }
}

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

@Override
public Query<E> clone() {
  Query<E> clone = new Query<E>(group, objectClass);
  clone.setPredicate(predicate);
  clone.setSorters(sorters != null ? new ArrayList<Sorter>(sorters) : null);
  clone.setFields(fields != null ? new ArrayList<String>(fields) : null);
  clone.setDatabase(database);
  clone.setResolveToReferenceOnly(isResolveToReferenceOnly);
  clone.setCache(!noCache);
  clone.setMaster(master);
  clone.setResolveInvisible(resolveInvisible);
  clone.setTimeout(timeout);
  clone.setOptions(options != null ? new HashMap<String, Object>(options) : null);
  return clone;
}

相关文章