java.lang.Object
org.springframework.data.relational.core.query.Criteria
- All Implemented Interfaces:
CriteriaDefinition
Central value class for creating criteria predicates. It follows a fluent (and immutable) API style so that you can
easily chain together multiple criteria. Static import of the
Criteria.property(…) method will improve
readability as in where(property(…).is(…).
The Criteria API supports composition with a NULL object and a static factory
method. Example usage:
Criteria.from(Criteria.where("name").is("Foo"), Criteria.from(Criteria.where("age").greaterThan(42)));
rendering:
WHERE name = 'Foo' AND age > 42
- Since:
- 2.0
- Author:
- Mark Paluch, Oliver Drotbohm, Roman Chigvintsev, Jens Schauder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface declaring terminal builder methods to build aCriteria.Nested classes/interfaces inherited from interface org.springframework.data.relational.core.query.CriteriaDefinition
CriteriaDefinition.Combinator, CriteriaDefinition.Comparator -
Method Summary
Modifier and TypeMethodDescriptionand(List<? extends CriteriaDefinition> criteria) and(CriteriaDefinition criteria) static Criteriaempty()Static factory method to create an empty Criteria.static Criteriastatic CriteriagetGroup()getValue()booleanignoreCase(boolean ignoreCase) Creates a newCriteriawith the given "ignore case" flag.booleanisEmpty()booleanisGroup()booleanChecks whether comparison should be done in case-insensitive way.or(List<? extends CriteriaDefinition> criteria) or(CriteriaDefinition criteria) toString()static Criteria.CriteriaStepStatic factory method to create a Criteria using the providedcolumnname.
-
Method Details
-
empty
Static factory method to create an empty Criteria.- Returns:
- an empty
Criteria.
-
from
- Returns:
- new
Criteria.
-
from
- Returns:
- new
Criteria.
-
where
Static factory method to create a Criteria using the providedcolumnname.- Parameters:
column- Must not be null or empty.- Returns:
- a new
Criteria.CriteriaStepobject to complete the firstCriteria.
-
and
- Parameters:
column- Must not be null or empty.- Returns:
- a new
Criteria.CriteriaStepobject to complete the nextCriteria.
-
and
- Parameters:
criteria- criteria object.- Returns:
- a new
Criteriaobject. - Since:
- 1.1
-
and
- Parameters:
criteria- criteria objects.- Returns:
- a new
Criteriaobject.
-
or
- Parameters:
column- Must not be null or empty.- Returns:
- a new
Criteria.CriteriaStepobject to complete the nextCriteria.
-
or
- Parameters:
criteria- criteria object.- Returns:
- a new
Criteriaobject. - Since:
- 1.1
-
or
- Parameters:
criteria- criteria object.- Returns:
- a new
Criteriaobject. - Since:
- 1.1
-
ignoreCase
Creates a newCriteriawith the given "ignore case" flag.- Parameters:
ignoreCase- true if comparison should be done in case-insensitive way- Returns:
- a new
Criteriaobject
-
getPrevious
- Specified by:
getPreviousin interfaceCriteriaDefinition- Returns:
- the previous
Criteriaobject. Can be null if there is no previousCriteria. - See Also:
-
hasPrevious
public boolean hasPrevious()- Specified by:
hasPreviousin interfaceCriteriaDefinition- Returns:
- true if this
Criteriahas a previous one.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCriteriaDefinition- Returns:
- true if this
Criteriais empty. - Since:
- 1.1
-
isGroup
public boolean isGroup()- Specified by:
isGroupin interfaceCriteriaDefinition- Returns:
- true if this
Criteriais empty.
-
getCombinator
- Specified by:
getCombinatorin interfaceCriteriaDefinition- Returns:
CriteriaDefinition.Combinatorto combine this criteria with a previous one.
-
getGroup
- Specified by:
getGroupin interfaceCriteriaDefinition
-
getColumn
- Specified by:
getColumnin interfaceCriteriaDefinition- Returns:
- the column/property name.
-
getComparator
- Specified by:
getComparatorin interfaceCriteriaDefinition- Returns:
CriteriaDefinition.Comparator.
-
getValue
- Specified by:
getValuein interfaceCriteriaDefinition- Returns:
- the comparison value. Can be null.
-
isIgnoreCase
public boolean isIgnoreCase()Checks whether comparison should be done in case-insensitive way.- Specified by:
isIgnoreCasein interfaceCriteriaDefinition- Returns:
- true if comparison should be done in case-insensitive way
-
toString
-