DATACMNS-1496 - Removed deprecations at least introduced in Lovelace.
This commit is contained in:
@@ -560,19 +560,7 @@ public interface ExampleMatcher {
|
||||
/**
|
||||
* Allows to transform the property value before it is used in the query.
|
||||
*/
|
||||
interface PropertyValueTransformer extends Function<Optional<Object>, Optional<Object>> {
|
||||
|
||||
/**
|
||||
* For backwards compatibility of clients used to invoke Spring's Converter interface.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
default Object convert(Object source) {
|
||||
return apply(Optional.ofNullable(source)).orElse(null);
|
||||
}
|
||||
}
|
||||
interface PropertyValueTransformer extends Function<Optional<Object>, Optional<Object>> {}
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
@@ -699,18 +687,6 @@ public interface ExampleMatcher {
|
||||
return valueTransformer == null ? NoOpPropertyValueTransformer.INSTANCE : valueTransformer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms a given source using the {@link PropertyValueTransformer}.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* @deprecated since 2.0, use {@link #transformValue(Optional)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Object transformValue(Object source) {
|
||||
return transformValue(Optional.ofNullable(source)).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms a given source using the {@link PropertyValueTransformer}.
|
||||
*
|
||||
|
||||
@@ -30,43 +30,14 @@ public class PageRequest extends AbstractPageRequest {
|
||||
|
||||
private final Sort sort;
|
||||
|
||||
/**
|
||||
* Creates a new {@link PageRequest}. Pages are zero indexed, thus providing 0 for {@code page} will return the first
|
||||
* page.
|
||||
*
|
||||
* @param page zero-based page index.
|
||||
* @param size the size of the page to be returned.
|
||||
* @deprecated use {@link #of(int, int)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public PageRequest(int page, int size) {
|
||||
this(page, size, Sort.unsorted());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link PageRequest} with sort parameters applied.
|
||||
*
|
||||
* @param page zero-based page index.
|
||||
* @param size the size of the page to be returned.
|
||||
* @param direction the direction of the {@link Sort} to be specified, can be {@literal null}.
|
||||
* @param properties the properties to sort by, must not be {@literal null} or empty.
|
||||
* @deprecated use {@link #of(int, int, Direction, String...)} instead.
|
||||
* @param sort must not be {@literal null}, use {@link Sort#unsorted()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public PageRequest(int page, int size, Direction direction, String... properties) {
|
||||
this(page, size, Sort.by(direction, properties));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link PageRequest} with sort parameters applied.
|
||||
*
|
||||
* @param page zero-based page index.
|
||||
* @param size the size of the page to be returned.
|
||||
* @param sort can be {@literal null}.
|
||||
* @deprecated since 2.0, use {@link #of(int, int, Sort)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public PageRequest(int page, int size, Sort sort) {
|
||||
protected PageRequest(int page, int size, Sort sort) {
|
||||
|
||||
super(page, size);
|
||||
|
||||
@@ -89,7 +60,7 @@ public class PageRequest extends AbstractPageRequest {
|
||||
*
|
||||
* @param page zero-based page index.
|
||||
* @param size the size of the page to be returned.
|
||||
* @param sort must not be {@literal null}.
|
||||
* @param sort must not be {@literal null}, use {@link Sort#unsorted()} instead.
|
||||
* @since 2.0
|
||||
*/
|
||||
public static PageRequest of(int page, int size, Sort sort) {
|
||||
@@ -121,6 +92,7 @@ public class PageRequest extends AbstractPageRequest {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Pageable#next()
|
||||
*/
|
||||
@Override
|
||||
public Pageable next() {
|
||||
return new PageRequest(getPageNumber() + 1, getPageSize(), getSort());
|
||||
}
|
||||
@@ -129,6 +101,7 @@ public class PageRequest extends AbstractPageRequest {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.AbstractPageRequest#previous()
|
||||
*/
|
||||
@Override
|
||||
public PageRequest previous() {
|
||||
return getPageNumber() == 0 ? this : new PageRequest(getPageNumber() - 1, getPageSize(), getSort());
|
||||
}
|
||||
@@ -137,6 +110,7 @@ public class PageRequest extends AbstractPageRequest {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Pageable#first()
|
||||
*/
|
||||
@Override
|
||||
public Pageable first() {
|
||||
return new PageRequest(0, getPageSize(), getSort());
|
||||
}
|
||||
|
||||
@@ -47,41 +47,6 @@ public class Range<T extends Comparable<T>> {
|
||||
*/
|
||||
private final @NonNull Bound<T> upperBound;
|
||||
|
||||
/**
|
||||
* Creates a new {@link Range} with the given lower and upper bound. Treats the given values as inclusive bounds. Use
|
||||
* {@link #Range(Comparable, Comparable, boolean, boolean)} to configure different bound behavior.
|
||||
*
|
||||
* @see Range#of(Bound, Bound)
|
||||
* @param lowerBound can be {@literal null} in case upperBound is not {@literal null}.
|
||||
* @param upperBound can be {@literal null} in case lowerBound is not {@literal null}.
|
||||
* @deprecated since 2.0 in favor of {@link Range#of(Bound, Bound)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public Range(T lowerBound, T upperBound) {
|
||||
this(lowerBound, upperBound, true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Range} with the given lower and upper bound as well as the given inclusive/exclusive
|
||||
* semantics.
|
||||
*
|
||||
* @param lowerBound can be {@literal null}.
|
||||
* @param upperBound can be {@literal null}.
|
||||
* @param lowerInclusive
|
||||
* @param upperInclusive
|
||||
* @deprecated since 2.0. Use {@link Range#of(Bound, Bound)} and {@link Bound} factory methods:
|
||||
* {@link Bound#inclusive(Comparable)}, {@link Bound#exclusive(Comparable)}/{@link Bound#unbounded()}.
|
||||
*/
|
||||
@Deprecated
|
||||
public Range(T lowerBound, T upperBound, boolean lowerInclusive, boolean upperInclusive) {
|
||||
|
||||
this.lowerBound = lowerBound == null ? Bound.unbounded()
|
||||
: lowerInclusive ? Bound.inclusive(lowerBound) : Bound.exclusive(lowerBound);
|
||||
|
||||
this.upperBound = upperBound == null ? Bound.unbounded()
|
||||
: upperInclusive ? Bound.inclusive(upperBound) : Bound.exclusive(upperBound);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unbounded {@link Range}.
|
||||
*
|
||||
@@ -117,24 +82,6 @@ public class Range<T extends Comparable<T>> {
|
||||
return new Range<>(lowerBound, upperBound);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @deprecated since 2.0, use {@link #getLowerBound()} and {@link Bound#isInclusive()}.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isLowerInclusive() {
|
||||
return lowerBound.isInclusive();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @deprecated since 2.0, use {@link #getUpperBound()} and {@link Bound#isInclusive()}.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isUpperInclusive() {
|
||||
return upperBound.isInclusive();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the {@link Range} contains the given value.
|
||||
*
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.domain;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -41,6 +44,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Thomas Darimont
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RequiredArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
public class Sort implements Streamable<org.springframework.data.domain.Sort.Order>, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5737186511678863905L;
|
||||
@@ -51,68 +55,21 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
|
||||
|
||||
private final List<Order> orders;
|
||||
|
||||
/**
|
||||
* Creates a new {@link Sort} instance using the given {@link Order}s.
|
||||
*
|
||||
* @param orders must not be {@literal null}.
|
||||
*/
|
||||
@Deprecated
|
||||
public Sort(Order... orders) {
|
||||
this(Arrays.asList(orders));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Sort} instance.
|
||||
*
|
||||
* @param orders must not be {@literal null} or contain {@literal null}.
|
||||
* @deprecated see {@link Sort#by(List)}
|
||||
*/
|
||||
@Deprecated
|
||||
public Sort(List<Order> orders) {
|
||||
|
||||
Assert.notNull(orders, "Orders must not be null!");
|
||||
|
||||
this.orders = Collections.unmodifiableList(orders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Sort} instance. Order defaults to {@value Direction#ASC}.
|
||||
*
|
||||
* @param properties must not be {@literal null} or contain {@literal null} or empty strings
|
||||
* @deprecated use {@link Sort#by(String...)}
|
||||
*/
|
||||
@Deprecated
|
||||
public Sort(String... properties) {
|
||||
this(DEFAULT_DIRECTION, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Sort} instance.
|
||||
*
|
||||
* @param direction defaults to {@link Sort#DEFAULT_DIRECTION} (for {@literal null} cases, too)
|
||||
* @param properties must not be {@literal null}, empty or contain {@literal null} or empty strings.
|
||||
*/
|
||||
public Sort(Direction direction, String... properties) {
|
||||
this(direction, properties == null ? new ArrayList<>() : Arrays.asList(properties));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Sort} instance.
|
||||
*
|
||||
* @param direction defaults to {@link Sort#DEFAULT_DIRECTION} (for {@literal null} cases, too)
|
||||
* @param properties must not be {@literal null} or contain {@literal null} or empty strings.
|
||||
*/
|
||||
public Sort(Direction direction, List<String> properties) {
|
||||
private Sort(Direction direction, List<String> properties) {
|
||||
|
||||
if (properties == null || properties.isEmpty()) {
|
||||
throw new IllegalArgumentException("You have to provide at least one property to sort by!");
|
||||
}
|
||||
|
||||
this.orders = new ArrayList<>(properties.size());
|
||||
|
||||
for (String property : properties) {
|
||||
this.orders.add(new Order(direction, property));
|
||||
}
|
||||
this.orders = properties.stream() //
|
||||
.map(it -> new Order(direction, it)) //
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +82,9 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
|
||||
|
||||
Assert.notNull(properties, "Properties must not be null!");
|
||||
|
||||
return properties.length == 0 ? Sort.unsorted() : new Sort(properties);
|
||||
return properties.length == 0 //
|
||||
? Sort.unsorted() //
|
||||
: new Sort(DEFAULT_DIRECTION, Arrays.asList(properties));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +110,7 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
|
||||
|
||||
Assert.notNull(orders, "Orders must not be null!");
|
||||
|
||||
return new Sort(orders);
|
||||
return new Sort(Arrays.asList(orders));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,7 +133,7 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
|
||||
|
||||
/**
|
||||
* Creates a new {@link TypedSort} for the given type.
|
||||
*
|
||||
*
|
||||
* @param type must not be {@literal null}.
|
||||
* @return
|
||||
* @since 2.2
|
||||
@@ -444,18 +403,6 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
|
||||
this(direction, property, DEFAULT_IGNORE_CASE, nullHandlingHint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Order} instance. Takes a single property. Direction defaults to
|
||||
* {@link Sort#DEFAULT_DIRECTION}.
|
||||
*
|
||||
* @param property must not be {@literal null} or empty.
|
||||
* @deprecated since 2.0, use {@link Order#by(String)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public Order(String property) {
|
||||
this(DEFAULT_DIRECTION, property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Order} instance. Takes a single property. Direction defaults to
|
||||
* {@link Sort#DEFAULT_DIRECTION}.
|
||||
@@ -726,7 +673,7 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
|
||||
|
||||
private TypedSort(Recorded<T> recorded) {
|
||||
|
||||
super(new Order[0]);
|
||||
super(Collections.emptyList());
|
||||
this.recorded = recorded;
|
||||
}
|
||||
|
||||
@@ -742,10 +689,12 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
|
||||
return new TypedSort<>(recorded.record(mapProperty));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sort ascending() {
|
||||
return withDirection(Sort::ascending);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sort descending() {
|
||||
return withDirection(Sort::descending);
|
||||
}
|
||||
@@ -758,7 +707,7 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
|
||||
.orElseGet(Sort::unsorted);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Sort#iterator()
|
||||
*/
|
||||
@@ -772,7 +721,7 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Sort#toString()
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user