Skip to content

Commit 1ba2932

Browse files
committed
Polishing.
Reorder methods. See #2823
1 parent fd0964a commit 1ba2932

File tree

1 file changed

+23
-23
lines changed
  • src/main/java/org/springframework/data/domain

1 file changed

+23
-23
lines changed

src/main/java/org/springframework/data/domain/Sort.java

+23-23
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,28 @@ public Order(@Nullable Direction direction, String property, NullHandling nullHa
392392
this(direction, property, DEFAULT_IGNORE_CASE, nullHandlingHint);
393393
}
394394

395+
/**
396+
* Creates a new {@link Order} instance. if order is {@literal null} then order defaults to
397+
* {@link Sort#DEFAULT_DIRECTION}
398+
*
399+
* @param direction can be {@literal null}, will default to {@link Sort#DEFAULT_DIRECTION}
400+
* @param property must not be {@literal null} or empty.
401+
* @param ignoreCase true if sorting should be case-insensitive. false if sorting should be case-sensitive.
402+
* @param nullHandling must not be {@literal null}.
403+
* @since 1.7
404+
*/
405+
public Order(@Nullable Direction direction, String property, boolean ignoreCase, NullHandling nullHandling) {
406+
407+
if (!StringUtils.hasText(property)) {
408+
throw new IllegalArgumentException("Property must not be null or empty");
409+
}
410+
411+
this.direction = direction == null ? DEFAULT_DIRECTION : direction;
412+
this.property = property;
413+
this.ignoreCase = ignoreCase;
414+
this.nullHandling = nullHandling;
415+
}
416+
395417
/**
396418
* Creates a new {@link Order} instance. Takes a single property. Direction defaults to
397419
* {@link Sort#DEFAULT_DIRECTION}.
@@ -425,28 +447,6 @@ public static Order desc(String property) {
425447
return new Order(Direction.DESC, property, DEFAULT_NULL_HANDLING);
426448
}
427449

428-
/**
429-
* Creates a new {@link Order} instance. if order is {@literal null} then order defaults to
430-
* {@link Sort#DEFAULT_DIRECTION}
431-
*
432-
* @param direction can be {@literal null}, will default to {@link Sort#DEFAULT_DIRECTION}
433-
* @param property must not be {@literal null} or empty.
434-
* @param ignoreCase true if sorting should be case-insensitive. false if sorting should be case-sensitive.
435-
* @param nullHandling must not be {@literal null}.
436-
* @since 1.7
437-
*/
438-
public Order(@Nullable Direction direction, String property, boolean ignoreCase, NullHandling nullHandling) {
439-
440-
if (!StringUtils.hasText(property)) {
441-
throw new IllegalArgumentException("Property must not be null or empty");
442-
}
443-
444-
this.direction = direction == null ? DEFAULT_DIRECTION : direction;
445-
this.property = property;
446-
this.ignoreCase = ignoreCase;
447-
this.nullHandling = nullHandling;
448-
}
449-
450450
/**
451451
* Returns the order the property shall be sorted for.
452452
*
@@ -525,7 +525,7 @@ public Sort withProperties(String... properties) {
525525
}
526526

527527
/**
528-
* Returns a new {@link Order} with case insensitive sorting enabled.
528+
* Returns a new {@link Order} with case-insensitive sorting enabled.
529529
*
530530
* @return
531531
*/

0 commit comments

Comments
 (0)