2727import org .springframework .data .relational .core .sql .IdentifierProcessing ;
2828import org .springframework .data .relational .core .sql .SqlIdentifier ;
2929import org .springframework .data .util .Pair ;
30+ import org .springframework .lang .CheckReturnValue ;
3031import org .springframework .lang .Nullable ;
3132import org .springframework .util .Assert ;
3233
3334/**
34- * Central class for creating queries . It follows a fluent API style so that you can easily chain together multiple
35- * criteria. Static import of the {@code Criteria.property(…)} method will improve readability as in
36- * {@code where(property(…).is(…)}.
35+ * Central value class for creating criteria predicates . It follows a fluent (and immutable) API style so that you can
36+ * easily chain together multiple criteria. Static import of the {@code Criteria.property(…)} method will improve
37+ * readability as in {@code where(property(…).is(…)}.
3738 * <p>
3839 * The Criteria API supports composition with a {@link #empty() NULL object} and a {@link #from(List) static factory
3940 * method}. Example usage:
@@ -161,6 +162,7 @@ public static CriteriaStep where(String column) {
161162 * @param column Must not be {@literal null} or empty.
162163 * @return a new {@link CriteriaStep} object to complete the next {@link Criteria}.
163164 */
165+ @ CheckReturnValue
164166 public CriteriaStep and (String column ) {
165167
166168 Assert .hasText (column , "Column name must not be null or empty" );
@@ -181,6 +183,7 @@ protected Criteria createCriteria(Comparator comparator, @Nullable Object value)
181183 * @return a new {@link Criteria} object.
182184 * @since 1.1
183185 */
186+ @ CheckReturnValue
184187 public Criteria and (CriteriaDefinition criteria ) {
185188
186189 Assert .notNull (criteria , "Criteria must not be null" );
@@ -195,6 +198,7 @@ public Criteria and(CriteriaDefinition criteria) {
195198 * @return a new {@link Criteria} object.
196199 */
197200 @ SuppressWarnings ("unchecked" )
201+ @ CheckReturnValue
198202 public Criteria and (List <? extends CriteriaDefinition > criteria ) {
199203
200204 Assert .notNull (criteria , "Criteria must not be null" );
@@ -208,6 +212,7 @@ public Criteria and(List<? extends CriteriaDefinition> criteria) {
208212 * @param column Must not be {@literal null} or empty.
209213 * @return a new {@link CriteriaStep} object to complete the next {@link Criteria}.
210214 */
215+ @ CheckReturnValue
211216 public CriteriaStep or (String column ) {
212217
213218 Assert .hasText (column , "Column name must not be null or empty" );
@@ -228,6 +233,7 @@ protected Criteria createCriteria(Comparator comparator, @Nullable Object value)
228233 * @return a new {@link Criteria} object.
229234 * @since 1.1
230235 */
236+ @ CheckReturnValue
231237 public Criteria or (CriteriaDefinition criteria ) {
232238
233239 Assert .notNull (criteria , "Criteria must not be null" );
@@ -243,6 +249,7 @@ public Criteria or(CriteriaDefinition criteria) {
243249 * @since 1.1
244250 */
245251 @ SuppressWarnings ("unchecked" )
252+ @ CheckReturnValue
246253 public Criteria or (List <? extends CriteriaDefinition > criteria ) {
247254
248255 Assert .notNull (criteria , "Criteria must not be null" );
@@ -256,6 +263,7 @@ public Criteria or(List<? extends CriteriaDefinition> criteria) {
256263 * @param ignoreCase {@literal true} if comparison should be done in case-insensitive way
257264 * @return a new {@link Criteria} object
258265 */
266+ @ CheckReturnValue
259267 public Criteria ignoreCase (boolean ignoreCase ) {
260268 if (this .ignoreCase != ignoreCase ) {
261269 return new Criteria (previous , combinator , group , column , comparator , value , ignoreCase );
0 commit comments