@Override public GroupLoader<T> group(String... terms) { List<PropertyName> names = new ArrayList<>(); for (String term : terms) { PropertyName name = PropertyName.parse(term); Util.checkProperty(definition, name); names.add(name); } return new BasicGroupLoader<>(context, definition, factory, names, refComparator); }
static Ordering parseOrder(String expression) { Matcher matcher = PATTERN_ORDER.matcher(expression); if (matcher.matches() == false) { throw new IllegalArgumentException(MessageFormat.format( "invalid group ordering expression: {0}", expression)); } String name = null; Direction direction = null; for (Map.Entry<Integer, Direction> entry : ORDER_GROUP_DIRECTIONS.entrySet()) { int index = entry.getKey(); String s = matcher.group(index); if (s != null) { name = s; direction = entry.getValue(); break; } } assert name != null; assert direction != null; return new Ordering(PropertyName.parse(name), direction); }