Remove Specification.where method in favour of all().

Also remove serialVersionUID.

Original Pull Request: #3578
This commit is contained in:
Christoph Strobl
2024-08-19 15:41:07 +02:00
committed by Mark Paluch
parent 8c5f169186
commit 87edcd1ab6
4 changed files with 1 additions and 30 deletions

View File

@@ -20,7 +20,6 @@ import jakarta.persistence.criteria.CriteriaDelete;
import jakarta.persistence.criteria.Predicate;
import jakarta.persistence.criteria.Root;
import java.io.Serial;
import java.io.Serializable;
import java.util.Arrays;
import java.util.stream.StreamSupport;
@@ -37,8 +36,6 @@ import org.springframework.util.Assert;
@FunctionalInterface
public interface DeleteSpecification<T> extends Serializable {
@Serial long serialVersionUID = 1L;
/**
* Simple static factory method to create a specification deleting all objects.
*

View File

@@ -19,7 +19,6 @@ import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.Predicate;
import jakarta.persistence.criteria.Root;
import java.io.Serial;
import java.io.Serializable;
import java.util.Arrays;
import java.util.stream.StreamSupport;
@@ -35,8 +34,6 @@ import org.springframework.util.Assert;
*/
public interface PredicateSpecification<T> extends Serializable {
@Serial long serialVersionUID = 1L;
/**
* Simple static factory method to create a specification matching all objects.
*

View File

@@ -21,7 +21,6 @@ import jakarta.persistence.criteria.CriteriaUpdate;
import jakarta.persistence.criteria.Predicate;
import jakarta.persistence.criteria.Root;
import java.io.Serial;
import java.io.Serializable;
import java.util.Arrays;
import java.util.stream.StreamSupport;
@@ -44,8 +43,6 @@ import org.springframework.util.Assert;
@FunctionalInterface
public interface Specification<T> extends Serializable {
@Serial long serialVersionUID = 1L;
/**
* Simple static factory method to create a specification matching all objects.
*
@@ -56,23 +53,6 @@ public interface Specification<T> extends Serializable {
return (root, query, builder) -> null;
}
/**
* Simple static factory method to add some syntactic sugar around a {@link Specification}.
*
* @param <T> the type of the {@link Root} the resulting {@literal Specification} operates on.
* @param spec must not be {@literal null}.
* @return guaranteed to be not {@literal null}.
* @since 2.0
* @deprecated since 3.5.
*/
@Deprecated(since = "3.5.0", forRemoval = true)
static <T> Specification<T> where(Specification<T> spec) {
Assert.notNull(spec, "Specification must not be null");
return spec;
}
/**
* Simple static factory method to add some syntactic sugar translating {@link PredicateSpecification} to
* {@link Specification}.
@@ -85,7 +65,7 @@ public interface Specification<T> extends Serializable {
Assert.notNull(spec, "PredicateSpecification must not be null");
return where((root, update, criteriaBuilder) -> spec.toPredicate(root, criteriaBuilder));
return (root, update, criteriaBuilder) -> spec.toPredicate(root, criteriaBuilder);
}
/**

View File

@@ -20,7 +20,6 @@ import jakarta.persistence.criteria.CriteriaUpdate;
import jakarta.persistence.criteria.Predicate;
import jakarta.persistence.criteria.Root;
import java.io.Serial;
import java.io.Serializable;
import java.util.Arrays;
import java.util.stream.StreamSupport;
@@ -37,8 +36,6 @@ import org.springframework.util.Assert;
@FunctionalInterface
public interface UpdateSpecification<T> extends Serializable {
@Serial long serialVersionUID = 1L;
/**
* Simple static factory method to create a specification deleting all objects.
*