@@ -65,33 +65,35 @@ static <T> Specification<T> unrestricted() {
65
65
}
66
66
67
67
/**
68
- * Simple static factory method to add some syntactic sugar translating {@link PredicateSpecification} to
69
- * {@link Specification}.
68
+ * Simple static factory method to add some syntactic sugar around a {@link Specification}.
70
69
*
70
+ * @implNote does not accept {@literal null} values since 4.0, use {@link #unrestricted()} instead of passing
71
+ * {@literal null} values.
71
72
* @param <T> the type of the {@link Root} the resulting {@literal Specification} operates on.
72
- * @param spec the {@link PredicateSpecification} to wrap .
73
+ * @param spec can be {@literal null} .
73
74
* @return guaranteed to be not {@literal null}.
75
+ * @since 2.0
74
76
*/
75
- static <T > Specification <T > where (PredicateSpecification <T > spec ) {
77
+ static <T > Specification <T > where (Specification <T > spec ) {
76
78
77
- Assert .notNull (spec , "PredicateSpecification must not be null" );
79
+ Assert .notNull (spec , "Specification must not be null" );
78
80
79
- return ( root , update , criteriaBuilder ) -> spec . toPredicate ( root , criteriaBuilder ) ;
81
+ return spec ;
80
82
}
81
83
82
84
/**
83
- * Creates a {@link Specification} from the given {@link Specification}. This is a factory method for fluent composition.
85
+ * Simple static factory method to add some syntactic sugar translating {@link PredicateSpecification} to
86
+ * {@link Specification}.
84
87
*
85
88
* @param <T> the type of the {@link Root} the resulting {@literal Specification} operates on.
86
- * @param spec must not be {@literal null}.
87
- * @return the given specification.
88
- * @since 4.1
89
+ * @param spec the {@link PredicateSpecification} to wrap.
90
+ * @return guaranteed to be not {@literal null}.
89
91
*/
90
- static <T > Specification <T > where (Specification <T > spec ) {
92
+ static <T > Specification <T > where (PredicateSpecification <T > spec ) {
91
93
92
- Assert .notNull (spec , "Specification must not be null" );
94
+ Assert .notNull (spec , "PredicateSpecification must not be null" );
93
95
94
- return spec ;
96
+ return ( root , update , criteriaBuilder ) -> spec . toPredicate ( root , criteriaBuilder ) ;
95
97
}
96
98
97
99
/**
0 commit comments