29
29
import org .springframework .data .relational .core .sql .IdentifierProcessing ;
30
30
import org .springframework .data .relational .core .sql .SqlIdentifier ;
31
31
import org .springframework .data .util .Pair ;
32
+ import org .springframework .lang .CheckReturnValue ;
32
33
import org .springframework .util .Assert ;
33
34
34
35
/**
35
- * Central class for creating queries . It follows a fluent API style so that you can easily chain together multiple
36
- * criteria. Static import of the {@code Criteria.property(…)} method will improve readability as in
37
- * {@code where(property(…).is(…)}.
36
+ * Central value class for creating criteria predicates . It follows a fluent (and immutable) API style so that you can
37
+ * easily chain together multiple criteria. Static import of the {@code Criteria.property(…)} method will improve
38
+ * readability as in {@code where(property(…).is(…)}.
38
39
* <p>
39
40
* The Criteria API supports composition with a {@link #empty() NULL object} and a {@link #from(List) static factory
40
41
* method}. Example usage:
@@ -162,6 +163,7 @@ public static CriteriaStep where(String column) {
162
163
* @param column Must not be {@literal null} or empty.
163
164
* @return a new {@link CriteriaStep} object to complete the next {@link Criteria}.
164
165
*/
166
+ @ CheckReturnValue
165
167
public CriteriaStep and (String column ) {
166
168
167
169
Assert .hasText (column , "Column name must not be null or empty" );
@@ -182,6 +184,7 @@ protected Criteria createCriteria(Comparator comparator, @Nullable Object value)
182
184
* @return a new {@link Criteria} object.
183
185
* @since 1.1
184
186
*/
187
+ @ CheckReturnValue
185
188
public Criteria and (CriteriaDefinition criteria ) {
186
189
187
190
Assert .notNull (criteria , "Criteria must not be null" );
@@ -196,6 +199,7 @@ public Criteria and(CriteriaDefinition criteria) {
196
199
* @return a new {@link Criteria} object.
197
200
*/
198
201
@ SuppressWarnings ("unchecked" )
202
+ @ CheckReturnValue
199
203
public Criteria and (List <? extends CriteriaDefinition > criteria ) {
200
204
201
205
Assert .notNull (criteria , "Criteria must not be null" );
@@ -209,6 +213,7 @@ public Criteria and(List<? extends CriteriaDefinition> criteria) {
209
213
* @param column Must not be {@literal null} or empty.
210
214
* @return a new {@link CriteriaStep} object to complete the next {@link Criteria}.
211
215
*/
216
+ @ CheckReturnValue
212
217
public CriteriaStep or (String column ) {
213
218
214
219
Assert .hasText (column , "Column name must not be null or empty" );
@@ -229,6 +234,7 @@ protected Criteria createCriteria(Comparator comparator, @Nullable Object value)
229
234
* @return a new {@link Criteria} object.
230
235
* @since 1.1
231
236
*/
237
+ @ CheckReturnValue
232
238
public Criteria or (CriteriaDefinition criteria ) {
233
239
234
240
Assert .notNull (criteria , "Criteria must not be null" );
@@ -244,6 +250,7 @@ public Criteria or(CriteriaDefinition criteria) {
244
250
* @since 1.1
245
251
*/
246
252
@ SuppressWarnings ("unchecked" )
253
+ @ CheckReturnValue
247
254
public Criteria or (List <? extends CriteriaDefinition > criteria ) {
248
255
249
256
Assert .notNull (criteria , "Criteria must not be null" );
@@ -257,6 +264,7 @@ public Criteria or(List<? extends CriteriaDefinition> criteria) {
257
264
* @param ignoreCase {@literal true} if comparison should be done in case-insensitive way
258
265
* @return a new {@link Criteria} object
259
266
*/
267
+ @ CheckReturnValue
260
268
public Criteria ignoreCase (boolean ignoreCase ) {
261
269
if (this .ignoreCase != ignoreCase ) {
262
270
return new Criteria (previous , combinator , group , column , comparator , value , ignoreCase );
0 commit comments