Package io.micronaut.data.model.query
Interface Criteria
- All Known Subinterfaces:
QueryModel
- All Known Implementing Classes:
AssociationQuery
,DefaultQuery
public interface Criteria
Interface used for the construction of queries at compilation time an implementation may optionally
provide an implementation of this at runtime.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Method Summary
Modifier and TypeMethodDescription@NonNull Criteria
Apply an "equals" constraint to each property in the key set of aMap
.@NonNull Criteria
Creates a logical conjunction.@NonNull Criteria
Restricts the results by the given property value range (inclusive).@NonNull Criteria
Restricts the property match to strings containing with the given value.@NonNull Criteria
Restricts the property match to strings ending with the given value.@NonNull Criteria
Creates an "equals" Criterion based on the specified property name and value.@NonNull Criteria
Creates a subquery criterion that ensures the given property is equals to all the given returned values.@NonNull Criteria
eqProperty
(@NonNull String propertyName, @NonNull String otherPropertyName) Constrains a property to be equal to a specified other property.@NonNull Criteria
Used to restrict a value to be greater than or equal to the given value.@NonNull Criteria
Creates a subquery criterion that ensures the given property is greater than or equals to all the given returned values.@NonNull Criteria
geProperty
(@NonNull String propertyName, @NonNull String otherPropertyName) Constrains a property to be greater than or equal to a specified other property.@NonNull Criteria
Creates a subquery criterion that ensures the given property is greater than or equal to some of the given values.@NonNull Criteria
Used to restrict a value to be greater than or equal to the given value.@NonNull Criteria
Creates a subquery criterion that ensures the given property is greater than all the given returned values.@NonNull Criteria
Used to restrict a value to be greater than or equal to the given value.@NonNull Criteria
gtProperty
(@NonNull String propertyName, @NonNull String otherPropertyName) Constrains a property to be greater than a specified other property.@NonNull Criteria
Creates a subquery criterion that ensures the given property is greater than some of the given values.@NonNull Criteria
Creates an "equals" Criterion based on the specified property name and value.@NonNull Criteria
Creates an ilike Criterion based on the specified property name and value.@NonNull Criteria
inList
(@NonNull String propertyName, @NonNull QueryModel subquery) Creates an "in" Criterion using a subquery.@NonNull Criteria
Creates an "in" Criterion based on the specified property name and list of values.@NonNull Criteria
Creates a criterion that asserts the given property is empty (such as a blank string).@NonNull Criteria
Creates a criterion that asserts the given property is false.@NonNull Criteria
isNotEmpty
(@NonNull String propertyName) Creates a criterion that asserts the given property is not empty.@NonNull Criteria
Creates a criterion that asserts the given property is not null.@NonNull Criteria
Creates a criterion that asserts the given property is null.@NonNull Criteria
Creates a criterion that asserts the given property is true.@NonNull Criteria
Used to restrict a value to be less than or equal to the given value.@NonNull Criteria
Creates a subquery criterion that ensures the given property is less than or equal to all the given returned values.@NonNull Criteria
leProperty
(String propertyName, @NonNull String otherPropertyName) Constrains a property to be less than or equal to a specified other property.@NonNull Criteria
Creates a subquery criterion that ensures the given property is less than or equal to some of the given values.@NonNull Criteria
Creates a like Criterion based on the specified property name and value.@NonNull Criteria
Used to restrict a value to be less than or equal to the given value.@NonNull Criteria
Creates a subquery criterion that ensures the given property is less than all the given returned values.@NonNull Criteria
Used to restrict a value to be less than or equal to the given value.@NonNull Criteria
ltProperty
(@NonNull String propertyName, @NonNull String otherPropertyName) Constrains a property to be less than a specified other property.@NonNull Criteria
Creates a subquery criterion that ensures the given property is less than some of the given values.@NonNull Criteria
Creates a "not equals" Criterion based on the specified property name and value.@NonNull Criteria
neProperty
(@NonNull String propertyName, @NonNull String otherPropertyName) Constrains a property to be not equal to a specified other property.@NonNull Criteria
Creates a logical negation.@NonNull Criteria
notIn
(@NonNull String propertyName, @NonNull QueryModel subquery) Creates a negated "in" Criterion using a subquery.@NonNull Criteria
Creates a logical disjunction.@NonNull Criteria
Creates a rlike Criterion based on the specified property name and value.@NonNull Criteria
Creates a Criterion that constrains a collection property by size.@NonNull Criteria
Creates a Criterion that constrains a collection property to be greater than or equal to the given size.@NonNull Criteria
Creates a Criterion that constrains a collection property to be greater than the given size.@NonNull Criteria
Creates a Criterion that constrains a collection property to be less than or equal to the given size.@NonNull Criteria
Creates a Criterion that constrains a collection property to be less than to the given size.@NonNull Criteria
Creates a Criterion that constrains a collection property to be not equal to the given size.@NonNull Criteria
startsWith
(@NonNull String propertyName, @NonNull Object parameter) Restricts the property match to strings starting with the given value.@NonNull Criteria
Creates that restricts the version to the given value.
-
Method Details
-
idEq
Creates an "equals" Criterion based on the specified property name and value.- Parameters:
parameter
- The parameter that provides the value- Returns:
- The criteria
-
versionEq
Creates that restricts the version to the given value.- Parameters:
parameter
- The parameter that provides the value- Returns:
- The criteria
-
isEmpty
Creates a criterion that asserts the given property is empty (such as a blank string).- Parameters:
propertyName
- The property name- Returns:
- The criteria
-
isNotEmpty
Creates a criterion that asserts the given property is not empty.- Parameters:
propertyName
- The property name- Returns:
- The criteria
-
isNull
Creates a criterion that asserts the given property is null.- Parameters:
propertyName
- The property name- Returns:
- The criteria
-
isTrue
Creates a criterion that asserts the given property is true.- Parameters:
propertyName
- The property name- Returns:
- The criteria
-
isFalse
Creates a criterion that asserts the given property is false.- Parameters:
propertyName
- The property name- Returns:
- The criteria
-
isNotNull
Creates a criterion that asserts the given property is not null.- Parameters:
propertyName
- The property name- Returns:
- The criteria
-
eq
Creates an "equals" Criterion based on the specified property name and value.- Parameters:
propertyName
- The property nameparameter
- The parameter that provides the value- Returns:
- The criteria
-
ne
@NonNull @NonNull Criteria ne(@NonNull @NonNull String propertyName, @NonNull @NonNull Object parameter) Creates a "not equals" Criterion based on the specified property name and value.- Parameters:
propertyName
- The property nameparameter
- The parameter that provides the value- Returns:
- The criteria
-
between
@NonNull @NonNull Criteria between(@NonNull @NonNull String propertyName, @NonNull @NonNull Object start, @NonNull @NonNull Object finish) Restricts the results by the given property value range (inclusive).- Parameters:
propertyName
- The property namestart
- The start of the rangefinish
- The end of the range- Returns:
- The criteria
-
gte
@NonNull @NonNull Criteria gte(@NonNull @NonNull String property, @NonNull @NonNull Object parameter) Used to restrict a value to be greater than or equal to the given value.- Parameters:
property
- The propertyparameter
- The parameter that provides the value- Returns:
- The Criterion instance
-
ge
@NonNull @NonNull Criteria ge(@NonNull @NonNull String property, @NonNull @NonNull Object parameter) Used to restrict a value to be greater than or equal to the given value.- Parameters:
property
- The propertyparameter
- The parameter that provides the value- Returns:
- The Criterion instance
-
gt
@NonNull @NonNull Criteria gt(@NonNull @NonNull String property, @NonNull @NonNull Object parameter) Used to restrict a value to be greater than or equal to the given value.- Parameters:
property
- The propertyparameter
- The parameter that provides the value- Returns:
- The Criterion instance
-
lte
@NonNull @NonNull Criteria lte(@NonNull @NonNull String property, @NonNull @NonNull Object parameter) Used to restrict a value to be less than or equal to the given value.- Parameters:
property
- The propertyparameter
- The parameter that provides the value- Returns:
- The Criterion instance
-
le
@NonNull @NonNull Criteria le(@NonNull @NonNull String property, @NonNull @NonNull Object parameter) Used to restrict a value to be less than or equal to the given value.- Parameters:
property
- The propertyparameter
- The parameter that provides the value- Returns:
- The Criterion instance
-
lt
@NonNull @NonNull Criteria lt(@NonNull @NonNull String property, @NonNull @NonNull Object parameter) Used to restrict a value to be less than or equal to the given value.- Parameters:
property
- The propertyparameter
- The parameter that provides the value- Returns:
- The Criterion instance
-
like
@NonNull @NonNull Criteria like(@NonNull @NonNull String propertyName, @NonNull @NonNull Object parameter) Creates a like Criterion based on the specified property name and value.- Parameters:
propertyName
- The property nameparameter
- The parameter that provides the value- Returns:
- The criteria
-
startsWith
@NonNull @NonNull Criteria startsWith(@NonNull @NonNull String propertyName, @NonNull @NonNull Object parameter) Restricts the property match to strings starting with the given value.- Parameters:
propertyName
- The property nameparameter
- The parameter that provides the value- Returns:
- The criteria
-
endsWith
@NonNull @NonNull Criteria endsWith(@NonNull @NonNull String propertyName, @NonNull @NonNull Object parameter) Restricts the property match to strings ending with the given value.- Parameters:
propertyName
- The property nameparameter
- The parameter that provides the value- Returns:
- The criteria
-
contains
@NonNull @NonNull Criteria contains(@NonNull @NonNull String propertyName, @NonNull @NonNull Object parameter) Restricts the property match to strings containing with the given value.- Parameters:
propertyName
- The property nameparameter
- The parameter that provides the value- Returns:
- The criteria
-
ilike
@NonNull @NonNull Criteria ilike(@NonNull @NonNull String propertyName, @NonNull @NonNull Object parameter) Creates an ilike Criterion based on the specified property name and value. Unlike a like condition, ilike is case-insensitive.- Parameters:
propertyName
- The property nameparameter
- The parameter that provides the value- Returns:
- The criteria
-
rlike
@NonNull @NonNull Criteria rlike(@NonNull @NonNull String propertyName, @NonNull @NonNull Object parameter) Creates a rlike Criterion based on the specified property name and value.- Parameters:
propertyName
- The property nameparameter
- The parameter that provides the value- Returns:
- The criteria
-
and
Creates a logical conjunction.- Parameters:
other
- The other criteria- Returns:
- This criteria
-
or
Creates a logical disjunction.- Parameters:
other
- The other criteria- Returns:
- This criteria
-
not
Creates a logical negation.- Parameters:
other
- The other criteria- Returns:
- This criteria
-
inList
@NonNull @NonNull Criteria inList(@NonNull @NonNull String propertyName, @NonNull @NonNull QueryModel subquery) Creates an "in" Criterion using a subquery.- Parameters:
propertyName
- The property namesubquery
- The subquery- Returns:
- The criteria
-
inList
@NonNull @NonNull Criteria inList(@NonNull @NonNull String propertyName, @NonNull @NonNull Object parameter) Creates an "in" Criterion based on the specified property name and list of values.- Parameters:
propertyName
- The property nameparameter
- The parameter that provides the value- Returns:
- The criteria
-
notIn
@NonNull @NonNull Criteria notIn(@NonNull @NonNull String propertyName, @NonNull @NonNull QueryModel subquery) Creates a negated "in" Criterion using a subquery.- Parameters:
propertyName
- The property namesubquery
- The subquery- Returns:
- The criteria
-
sizeEq
@NonNull @NonNull Criteria sizeEq(@NonNull @NonNull String propertyName, @NonNull @NonNull Object size) Creates a Criterion that constrains a collection property by size.- Parameters:
propertyName
- The property namesize
- The size to constrain by- Returns:
- This criteria
-
sizeGt
@NonNull @NonNull Criteria sizeGt(@NonNull @NonNull String propertyName, @NonNull @NonNull Object size) Creates a Criterion that constrains a collection property to be greater than the given size.- Parameters:
propertyName
- The property namesize
- The size to constrain by- Returns:
- This criteria
-
sizeGe
@NonNull @NonNull Criteria sizeGe(@NonNull @NonNull String propertyName, @NonNull @NonNull Object size) Creates a Criterion that constrains a collection property to be greater than or equal to the given size.- Parameters:
propertyName
- The property namesize
- The size to constrain by- Returns:
- This criteria
-
sizeLe
@NonNull @NonNull Criteria sizeLe(@NonNull @NonNull String propertyName, @NonNull @NonNull Object size) Creates a Criterion that constrains a collection property to be less than or equal to the given size.- Parameters:
propertyName
- The property namesize
- The size to constrain by- Returns:
- This criteria
-
sizeLt
@NonNull @NonNull Criteria sizeLt(@NonNull @NonNull String propertyName, @NonNull @NonNull Object size) Creates a Criterion that constrains a collection property to be less than to the given size.- Parameters:
propertyName
- The property namesize
- The size to constrain by- Returns:
- This criteria
-
sizeNe
@NonNull @NonNull Criteria sizeNe(@NonNull @NonNull String propertyName, @NonNull @NonNull Object size) Creates a Criterion that constrains a collection property to be not equal to the given size.- Parameters:
propertyName
- The property namesize
- The size to constrain by- Returns:
- This criteria
-
eqProperty
@NonNull @NonNull Criteria eqProperty(@NonNull @NonNull String propertyName, @NonNull @NonNull String otherPropertyName) Constrains a property to be equal to a specified other property.- Parameters:
propertyName
- The propertyotherPropertyName
- The other property- Returns:
- This criteria
-
neProperty
@NonNull @NonNull Criteria neProperty(@NonNull @NonNull String propertyName, @NonNull @NonNull String otherPropertyName) Constrains a property to be not equal to a specified other property.- Parameters:
propertyName
- The propertyotherPropertyName
- The other property- Returns:
- This criteria
-
gtProperty
@NonNull @NonNull Criteria gtProperty(@NonNull @NonNull String propertyName, @NonNull @NonNull String otherPropertyName) Constrains a property to be greater than a specified other property.- Parameters:
propertyName
- The propertyotherPropertyName
- The other property- Returns:
- This criteria
-
geProperty
@NonNull @NonNull Criteria geProperty(@NonNull @NonNull String propertyName, @NonNull @NonNull String otherPropertyName) Constrains a property to be greater than or equal to a specified other property.- Parameters:
propertyName
- The propertyotherPropertyName
- The other property- Returns:
- This criteria
-
ltProperty
@NonNull @NonNull Criteria ltProperty(@NonNull @NonNull String propertyName, @NonNull @NonNull String otherPropertyName) Constrains a property to be less than a specified other property.- Parameters:
propertyName
- The propertyotherPropertyName
- The other property- Returns:
- This criteria
-
leProperty
@NonNull @NonNull Criteria leProperty(String propertyName, @NonNull @NonNull String otherPropertyName) Constrains a property to be less than or equal to a specified other property.- Parameters:
propertyName
- The propertyotherPropertyName
- The other property- Returns:
- This criteria
-
allEq
Apply an "equals" constraint to each property in the key set of aMap
.- Parameters:
propertyValues
- a map from property names to values- Returns:
- Criterion
-
eqAll
@NonNull @NonNull Criteria eqAll(@NonNull @NonNull String propertyName, @NonNull @NonNull Criteria propertyValue) Creates a subquery criterion that ensures the given property is equals to all the given returned values.- Parameters:
propertyName
- The property namepropertyValue
- A subquery- Returns:
- This criterion instance
-
gtAll
@NonNull @NonNull Criteria gtAll(@NonNull @NonNull String propertyName, @NonNull @NonNull Criteria propertyValue) Creates a subquery criterion that ensures the given property is greater than all the given returned values.- Parameters:
propertyName
- The property namepropertyValue
- A subquery- Returns:
- This criterion instance
-
ltAll
@NonNull @NonNull Criteria ltAll(@NonNull @NonNull String propertyName, @NonNull @NonNull Criteria propertyValue) Creates a subquery criterion that ensures the given property is less than all the given returned values.- Parameters:
propertyName
- The property namepropertyValue
- A subquery- Returns:
- This criterion instance
-
geAll
@NonNull @NonNull Criteria geAll(@NonNull @NonNull String propertyName, @NonNull @NonNull Criteria propertyValue) Creates a subquery criterion that ensures the given property is greater than or equals to all the given returned values.- Parameters:
propertyName
- The property namepropertyValue
- A subquery- Returns:
- This criterion instance
-
leAll
@NonNull @NonNull Criteria leAll(@NonNull @NonNull String propertyName, @NonNull @NonNull Criteria propertyValue) Creates a subquery criterion that ensures the given property is less than or equal to all the given returned values.- Parameters:
propertyName
- The property namepropertyValue
- A subquery- Returns:
- This criterion instance
-
gtSome
@NonNull @NonNull Criteria gtSome(@NonNull @NonNull String propertyName, @NonNull @NonNull Criteria propertyValue) Creates a subquery criterion that ensures the given property is greater than some of the given values.- Parameters:
propertyName
- The property namepropertyValue
- The property value- Returns:
- This Criteria instance
-
geSome
@NonNull @NonNull Criteria geSome(@NonNull @NonNull String propertyName, @NonNull @NonNull Criteria propertyValue) Creates a subquery criterion that ensures the given property is greater than or equal to some of the given values.- Parameters:
propertyName
- The property namepropertyValue
- The property value- Returns:
- This Criteria instance
-
ltSome
@NonNull @NonNull Criteria ltSome(@NonNull @NonNull String propertyName, @NonNull @NonNull Criteria propertyValue) Creates a subquery criterion that ensures the given property is less than some of the given values.- Parameters:
propertyName
- The property namepropertyValue
- The property value- Returns:
- This Criteria instance
-
leSome
@NonNull @NonNull Criteria leSome(@NonNull @NonNull String propertyName, @NonNull @NonNull Criteria propertyValue) Creates a subquery criterion that ensures the given property is less than or equal to some of the given values.- Parameters:
propertyName
- The property namepropertyValue
- The property value- Returns:
- This Criteria instance
-