2828import org .springframework .data .relational .core .sql .IdentifierProcessing ;
2929import org .springframework .data .relational .core .sql .SqlIdentifier ;
3030import org .springframework .data .util .Pair ;
31+ import org .springframework .lang .CheckReturnValue ;
3132import org .springframework .lang .Nullable ;
3233import org .springframework .util .Assert ;
3334
3435/**
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(…)}.
3839 * <p>
3940 * The Criteria API supports composition with a {@link #empty() NULL object} and a {@link #from(List) static factory
4041 * method}. Example usage:
@@ -162,6 +163,7 @@ public static CriteriaStep where(String column) {
162163 * @param column Must not be {@literal null} or empty.
163164 * @return a new {@link CriteriaStep} object to complete the next {@link Criteria}.
164165 */
166+ @ CheckReturnValue
165167 public CriteriaStep and (String column ) {
166168
167169 Assert .hasText (column , "Column name must not be null or empty" );
@@ -182,6 +184,7 @@ protected Criteria createCriteria(Comparator comparator, @Nullable Object value)
182184 * @return a new {@link Criteria} object.
183185 * @since 1.1
184186 */
187+ @ CheckReturnValue
185188 public Criteria and (CriteriaDefinition criteria ) {
186189
187190 Assert .notNull (criteria , "Criteria must not be null" );
@@ -196,6 +199,7 @@ public Criteria and(CriteriaDefinition criteria) {
196199 * @return a new {@link Criteria} object.
197200 */
198201 @ SuppressWarnings ("unchecked" )
202+ @ CheckReturnValue
199203 public Criteria and (List <? extends CriteriaDefinition > criteria ) {
200204
201205 Assert .notNull (criteria , "Criteria must not be null" );
@@ -209,6 +213,7 @@ public Criteria and(List<? extends CriteriaDefinition> criteria) {
209213 * @param column Must not be {@literal null} or empty.
210214 * @return a new {@link CriteriaStep} object to complete the next {@link Criteria}.
211215 */
216+ @ CheckReturnValue
212217 public CriteriaStep or (String column ) {
213218
214219 Assert .hasText (column , "Column name must not be null or empty" );
@@ -229,6 +234,7 @@ protected Criteria createCriteria(Comparator comparator, @Nullable Object value)
229234 * @return a new {@link Criteria} object.
230235 * @since 1.1
231236 */
237+ @ CheckReturnValue
232238 public Criteria or (CriteriaDefinition criteria ) {
233239
234240 Assert .notNull (criteria , "Criteria must not be null" );
@@ -244,6 +250,7 @@ public Criteria or(CriteriaDefinition criteria) {
244250 * @since 1.1
245251 */
246252 @ SuppressWarnings ("unchecked" )
253+ @ CheckReturnValue
247254 public Criteria or (List <? extends CriteriaDefinition > criteria ) {
248255
249256 Assert .notNull (criteria , "Criteria must not be null" );
@@ -257,6 +264,7 @@ public Criteria or(List<? extends CriteriaDefinition> criteria) {
257264 * @param ignoreCase {@literal true} if comparison should be done in case-insensitive way
258265 * @return a new {@link Criteria} object
259266 */
267+ @ CheckReturnValue
260268 public Criteria ignoreCase (boolean ignoreCase ) {
261269 if (this .ignoreCase != ignoreCase ) {
262270 return new Criteria (previous , combinator , group , column , comparator , value , ignoreCase );
0 commit comments