Polishing.

Reorder methods.

See #2823
This commit is contained in:
Mark Paluch
2023-05-11 15:41:08 +02:00
parent fd0964ab72
commit 1ba2932275

View File

@@ -392,6 +392,28 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
this(direction, property, DEFAULT_IGNORE_CASE, nullHandlingHint);
}
/**
* Creates a new {@link Order} instance. if order is {@literal null} then order defaults to
* {@link Sort#DEFAULT_DIRECTION}
*
* @param direction can be {@literal null}, will default to {@link Sort#DEFAULT_DIRECTION}
* @param property must not be {@literal null} or empty.
* @param ignoreCase true if sorting should be case-insensitive. false if sorting should be case-sensitive.
* @param nullHandling must not be {@literal null}.
* @since 1.7
*/
public Order(@Nullable Direction direction, String property, boolean ignoreCase, NullHandling nullHandling) {
if (!StringUtils.hasText(property)) {
throw new IllegalArgumentException("Property must not be null or empty");
}
this.direction = direction == null ? DEFAULT_DIRECTION : direction;
this.property = property;
this.ignoreCase = ignoreCase;
this.nullHandling = nullHandling;
}
/**
* Creates a new {@link Order} instance. Takes a single property. Direction defaults to
* {@link Sort#DEFAULT_DIRECTION}.
@@ -425,28 +447,6 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
return new Order(Direction.DESC, property, DEFAULT_NULL_HANDLING);
}
/**
* Creates a new {@link Order} instance. if order is {@literal null} then order defaults to
* {@link Sort#DEFAULT_DIRECTION}
*
* @param direction can be {@literal null}, will default to {@link Sort#DEFAULT_DIRECTION}
* @param property must not be {@literal null} or empty.
* @param ignoreCase true if sorting should be case-insensitive. false if sorting should be case-sensitive.
* @param nullHandling must not be {@literal null}.
* @since 1.7
*/
public Order(@Nullable Direction direction, String property, boolean ignoreCase, NullHandling nullHandling) {
if (!StringUtils.hasText(property)) {
throw new IllegalArgumentException("Property must not be null or empty");
}
this.direction = direction == null ? DEFAULT_DIRECTION : direction;
this.property = property;
this.ignoreCase = ignoreCase;
this.nullHandling = nullHandling;
}
/**
* Returns the order the property shall be sorted for.
*
@@ -525,7 +525,7 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
}
/**
* Returns a new {@link Order} with case insensitive sorting enabled.
* Returns a new {@link Order} with case-insensitive sorting enabled.
*
* @return
*/