@Test(expected = IllegalArgumentException.class) public void testParseUnknown() { Ordering.parse("unknown"); }
public static Ordering parse(String ordering) { if (ordering == null) { return Ordering.empty(); } final StringTokenizer tokenizer = new StringTokenizer(ordering, ","); final Map<Field, Direction> fields = Maps.newLinkedHashMap(); while (tokenizer.hasMoreTokens()) { final String token = tokenizer.nextToken(); final int index = token.indexOf('-'); final Direction direction = index > -1 ? Direction.DESCENDING : Direction.ASCENDING; final Field field = Field.fromName(token.substring(index + 1)); Preconditions.checkArgument( field != null, "Unsupported ordering field: %s", token ); fields.put(field, direction); } return new Ordering(fields); }
Ordering { public static Ordering parse(String ordering) { if (ordering == null) { return Ordering.empty(); } final StringTokenizer tokenizer = new StringTokenizer(ordering, ","); final Map<Field, Direction> fields = Maps.newLinkedHashMap(); while (tokenizer.hasMoreTokens()) { final String token = tokenizer.nextToken(); final int index = token.indexOf('-'); final Direction direction = index > -1 ? Direction.DESCENDING : Direction.ASCENDING; final Field field = Field.fromName(token.substring(index + 1)); Preconditions.checkArgument( field != null, "Unsupported ordering field: %s", token ); fields.put(field, direction); } return new Ordering(fields); } }
Ordering { public static Ordering parse(String ordering) { if (ordering == null) { return Ordering.empty(); } final StringTokenizer tokenizer = new StringTokenizer(ordering, ","); final Map<Field, Direction> fields = Maps.newLinkedHashMap(); while (tokenizer.hasMoreTokens()) { final String token = tokenizer.nextToken(); final int index = token.indexOf('-'); final Direction direction = index > -1 ? Direction.DESCENDING : Direction.ASCENDING; final Field field = Field.fromName(token.substring(index + 1)); Preconditions.checkArgument( field != null, "Unsupported ordering field: %s", token ); fields.put(field, direction); } return new Ordering(fields); } private  Ordering(Map<Field, Direction> fields); }
Ordering { public static Ordering parse(String ordering) { if (ordering == null) { return Ordering.empty(); } final StringTokenizer tokenizer = new StringTokenizer(ordering, ","); final Map<Field, Direction> fields = Maps.newLinkedHashMap(); while (tokenizer.hasMoreTokens()) { final String token = tokenizer.nextToken(); final int index = token.indexOf('-'); final Direction direction = index > -1 ? Direction.DESCENDING : Direction.ASCENDING; final Field field = Field.fromName(token.substring(index + 1)); Preconditions.checkArgument( field != null, "Unsupported ordering field: %s", token ); fields.put(field, direction); } return new Ordering(fields); } private  Ordering(Map<Field, Direction> fields); Map<Field, Direction> getFields(); boolean isEmpty(); static Ordering parse(String ordering); static Ordering empty(); static Builder newBuilder(); }
Ordering { public static Ordering parse(String ordering) { if (ordering == null) { return Ordering.empty(); } final StringTokenizer tokenizer = new StringTokenizer(ordering, ","); final Map<Field, Direction> fields = Maps.newLinkedHashMap(); while (tokenizer.hasMoreTokens()) { final String token = tokenizer.nextToken(); final int index = token.indexOf('-'); final Direction direction = index > -1 ? Direction.DESCENDING : Direction.ASCENDING; final Field field = Field.fromName(token.substring(index + 1)); Preconditions.checkArgument( field != null, "Unsupported ordering field: %s", token ); fields.put(field, direction); } return new Ordering(fields); } private  Ordering(Map<Field, Direction> fields); Map<Field, Direction> getFields(); boolean isEmpty(); static Ordering parse(String ordering); static Ordering empty(); static Builder newBuilder();  }