File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
spring-data-jpa/src/main/java/org/springframework/data/jpa/domain Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,17 @@ static <T> Specification<T> not(@Nullable Specification<T> spec) {
6464 };
6565 }
6666
67+ /**
68+ * Simple static factory method to create a specification matching all objects.
69+ *
70+ * @param <T> the type of the {@link Root} the resulting {@literal Specification} operates on.
71+ * @return guaranteed to be not {@literal null}.
72+ * @since 3.5.2
73+ */
74+ static <T > Specification <T > unrestricted () {
75+ return (root , query , builder ) -> null ;
76+ }
77+
6778 /**
6879 * Simple static factory method to add some syntactic sugar around a {@link Specification}.
6980 *
@@ -72,11 +83,12 @@ static <T> Specification<T> not(@Nullable Specification<T> spec) {
7283 * @param spec can be {@literal null}.
7384 * @return guaranteed to be not {@literal null}.
7485 * @since 2.0
75- * @deprecated since 3.5, to be removed with 4.0 as we no longer want to support {@literal null} specifications.
86+ * @deprecated since 3.5, to be removed with 4.0 as we no longer want to support {@literal null} specifications. Use
87+ * {@link #unrestricted()} instead.
7688 */
7789 @ Deprecated (since = "3.5.0" , forRemoval = true )
7890 static <T > Specification <T > where (@ Nullable Specification <T > spec ) {
79- return spec == null ? ( root , query , builder ) -> null : spec ;
91+ return spec == null ? unrestricted () : spec ;
8092 }
8193
8294 /**
You can’t perform that action at this time.
0 commit comments