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) {
64
64
};
65
65
}
66
66
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
+
67
78
/**
68
79
* Simple static factory method to add some syntactic sugar around a {@link Specification}.
69
80
*
@@ -72,11 +83,12 @@ static <T> Specification<T> not(@Nullable Specification<T> spec) {
72
83
* @param spec can be {@literal null}.
73
84
* @return guaranteed to be not {@literal null}.
74
85
* @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.
76
88
*/
77
89
@ Deprecated (since = "3.5.0" , forRemoval = true )
78
90
static <T > Specification <T > where (@ Nullable Specification <T > spec ) {
79
- return spec == null ? ( root , query , builder ) -> null : spec ;
91
+ return spec == null ? unrestricted () : spec ;
80
92
}
81
93
82
94
/**
You can’t perform that action at this time.
0 commit comments