@Test public void sortToOrderSpecifier_Descending() { String sortExpression = "sort(-employee.id)"; DefaultSortParser sortParser = new DefaultSortParser(); Map<String, Path> mappings = ImmutableMap.<String, Path>builder() .put("employee.id", QEmployee.employee.employeeNumber) .build(); OrderSpecifierList orderSpecifierList = sortParser.parse(sortExpression, QuerydslSortContext.withMapping(mappings)); assertNotNull(orderSpecifierList); List<OrderSpecifier> orderSpecifiers = orderSpecifierList.getOrders(); assertNotNull(orderSpecifiers); assertEquals(1, orderSpecifiers.size()); OrderSpecifier orderSpecifier = orderSpecifiers.get(0); assertEquals(Order.DESC, orderSpecifier.getOrder()); assertEquals(QEmployee.employee.employeeNumber, orderSpecifier.getTarget()); }
public static QuerydslSortContext withMapping(Map<String, Path> mappings) { return (QuerydslSortContext) new QuerydslSortContext() .setSortParam(new QuerydslSortParam().setMapping(mappings)) .setSortBuilder(new QuerydslSortBuilder()); }
QuerydslSortContext extends SortContext<OrderSpecifierList, QuerydslSortParam> { public static QuerydslSortContext withMapping(Map<String, Path> mappings) { return (QuerydslSortContext) new QuerydslSortContext() .setSortParam(new QuerydslSortParam().setMapping(mappings)) .setSortBuilder(new QuerydslSortBuilder()); } }
QuerydslSortContext extends SortContext<OrderSpecifierList, QuerydslSortParam> { public static QuerydslSortContext withMapping(Map<String, Path> mappings) { return (QuerydslSortContext) new QuerydslSortContext() .setSortParam(new QuerydslSortParam().setMapping(mappings)) .setSortBuilder(new QuerydslSortBuilder()); }  }
QuerydslSortContext extends SortContext<OrderSpecifierList, QuerydslSortParam> { public static QuerydslSortContext withMapping(Map<String, Path> mappings) { return (QuerydslSortContext) new QuerydslSortContext() .setSortParam(new QuerydslSortParam().setMapping(mappings)) .setSortBuilder(new QuerydslSortBuilder()); }  static QuerydslSortContext withMapping(Map<String, Path> mappings); }
QuerydslSortContext extends SortContext<OrderSpecifierList, QuerydslSortParam> { public static QuerydslSortContext withMapping(Map<String, Path> mappings) { return (QuerydslSortContext) new QuerydslSortContext() .setSortParam(new QuerydslSortParam().setMapping(mappings)) .setSortBuilder(new QuerydslSortBuilder()); }  static QuerydslSortContext withMapping(Map<String, Path> mappings);  }