Skip to content

Commit

Permalink
Remove Specification.where method in favour of all().
Browse files Browse the repository at this point in the history
Also remove serialVersionUID.

Original Pull Request: #3578
  • Loading branch information
christophstrobl authored and mp911de committed Jan 14, 2025
1 parent ae79ff5 commit 6ae97f0
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
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;
Expand All @@ -37,8 +36,6 @@
@FunctionalInterface
public interface DeleteSpecification<T> extends Serializable {

@Serial long serialVersionUID = 1L;

/**
* Simple static factory method to create a specification deleting all objects.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
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;
Expand All @@ -35,8 +34,6 @@
*/
public interface PredicateSpecification<T> extends Serializable {

@Serial long serialVersionUID = 1L;

/**
* Simple static factory method to create a specification matching all objects.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
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;
Expand All @@ -44,8 +43,6 @@
@FunctionalInterface
public interface Specification<T> extends Serializable {

@Serial long serialVersionUID = 1L;

/**
* Simple static factory method to create a specification matching all objects.
*
Expand All @@ -56,23 +53,6 @@ static <T> Specification<T> all() {
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}.
Expand All @@ -85,7 +65,7 @@ static <T> Specification<T> where(PredicateSpecification<T> spec) {

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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
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;
Expand All @@ -37,8 +36,6 @@
@FunctionalInterface
public interface UpdateSpecification<T> extends Serializable {

@Serial long serialVersionUID = 1L;

/**
* Simple static factory method to create a specification deleting all objects.
*
Expand Down

0 comments on commit 6ae97f0

Please sign in to comment.