public class DefaultQuery extends java.lang.Object implements QueryModel
QueryModel.AvgProjection, QueryModel.Between, QueryModel.Conjunction, QueryModel.Contains, QueryModel.CountDistinctProjection, QueryModel.CountProjection, QueryModel.Criterion, QueryModel.Disjunction, QueryModel.DistinctProjection, QueryModel.DistinctPropertyProjection, QueryModel.EndsWith, QueryModel.Equals, QueryModel.EqualsAll, QueryModel.EqualsProperty, QueryModel.Exists, QueryModel.GreaterThan, QueryModel.GreaterThanAll, QueryModel.GreaterThanEquals, QueryModel.GreaterThanEqualsAll, QueryModel.GreaterThanEqualsProperty, QueryModel.GreaterThanEqualsSome, QueryModel.GreaterThanProperty, QueryModel.GreaterThanSome, QueryModel.GroupPropertyProjection, QueryModel.IdEquals, QueryModel.IdProjection, QueryModel.ILike, QueryModel.In, QueryModel.IsEmpty, QueryModel.IsFalse, QueryModel.IsNotEmpty, QueryModel.IsNotNull, QueryModel.IsNull, QueryModel.IsTrue, QueryModel.Junction, QueryModel.LessThan, QueryModel.LessThanAll, QueryModel.LessThanEquals, QueryModel.LessThanEqualsAll, QueryModel.LessThanEqualsProperty, QueryModel.LessThanEqualsSome, QueryModel.LessThanProperty, QueryModel.LessThanSome, QueryModel.Like, QueryModel.MaxProjection, QueryModel.MinProjection, QueryModel.Negation, QueryModel.NotEquals, QueryModel.NotEqualsAll, QueryModel.NotEqualsProperty, QueryModel.NotExists, QueryModel.NotIn, QueryModel.Projection, QueryModel.PropertyComparisonCriterion, QueryModel.PropertyCriterion, QueryModel.PropertyNameCriterion, QueryModel.PropertyProjection, QueryModel.RLike, QueryModel.SizeEquals, QueryModel.SizeGreaterThan, QueryModel.SizeGreaterThanEquals, QueryModel.SizeLessThan, QueryModel.SizeLessThanEquals, QueryModel.SizeNotEquals, QueryModel.StartsWith, QueryModel.SubqueryCriterion, QueryModel.SumProjection
Modifier | Constructor and Description |
---|---|
protected |
DefaultQuery(PersistentEntity entity)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
QueryModel |
add(QueryModel.Criterion criterion)
Adds the specified criterion instance to the query.
|
DefaultQuery |
allEq(java.util.Map<java.lang.String,QueryParameter> values)
Shortcut to restrict the query to multiple given property values.
|
Criteria |
and(Criteria other)
Creates a logical conjunction.
|
DefaultQuery |
and(QueryModel.Criterion a,
QueryModel.Criterion b)
Creates a conjunction using two specified criterion.
|
DefaultQuery |
between(java.lang.String property,
QueryParameter start,
QueryParameter end)
Restricts the results by the given property value range.
|
QueryModel.Junction |
conjunction()
Creates a conjunction (AND) query.
|
Criteria |
contains(java.lang.String propertyName,
QueryParameter parameter)
Restricts the property match to strings containing with the given value.
|
AssociationQuery |
createQuery(java.lang.String associationName)
Creates an association query.
|
QueryModel.Junction |
disjunction()
Creates a disjunction (OR) query.
|
Criteria |
endsWith(java.lang.String propertyName,
QueryParameter parameter)
Restricts the property match to strings ending with the given value.
|
DefaultQuery |
eq(java.lang.String property,
QueryParameter parameter)
Restricts the results by the given properties value.
|
Criteria |
eqAll(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is equals to all the given returned values.
|
DefaultQuery |
eqProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Constrains a property to be equal to a specified other property.
|
DefaultQuery |
ge(java.lang.String property,
QueryParameter value)
Used to restrict a value to be greater than or equal to the given value.
|
Criteria |
geAll(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is greater than or equals to all the given returned values.
|
DefaultQuery |
geProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Constrains a property to be greater than or equal to a specified other property.
|
Criteria |
geSome(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is greater than or equal to some of the given values.
|
QueryModel.Junction |
getCriteria() |
PersistentEntity |
getEntity() |
java.util.Optional<JoinPath> |
getJoinPath(java.lang.String path)
Obtain the joint for for a given association.
|
java.util.Collection<JoinPath> |
getJoinPaths() |
int |
getMax()
Get the pageSize results to return.
|
long |
getOffset()
Get the offset of the query.
|
PersistentEntity |
getPersistentEntity() |
java.util.List<QueryModel.Projection> |
getProjections() |
Sort |
getSort()
The sort to apply.
|
DefaultQuery |
gt(java.lang.String property,
QueryParameter value)
Used to restrict a value to be greater than the given value.
|
Criteria |
gtAll(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is greater than all the given returned values.
|
DefaultQuery |
gte(java.lang.String property,
QueryParameter value)
Used to restrict a value to be greater than or equal to the given value.
|
DefaultQuery |
gtProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Constrains a property to be greater than a specified other property.
|
Criteria |
gtSome(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is greater than some of the given values.
|
DefaultQuery |
idEq(QueryParameter value)
Restricts the results by the given properties value.
|
Criteria |
idEquals(QueryParameter parameter)
Creates a criterion that restricts the id to the given value.
|
DefaultQuery |
ilike(java.lang.String propertyName,
QueryParameter parameter)
Creates an ilike Criterion based on the specified property name and value.
|
DefaultQuery |
inList(java.lang.String propertyName,
QueryModel subquery)
Creates an "in" Criterion using a subquery.
|
DefaultQuery |
inList(java.lang.String property,
QueryParameter values)
Restricts the results by the given property values.
|
DefaultQuery |
isEmpty(java.lang.String property)
Used to restrict a value to be empty (such as a blank string or an empty collection).
|
Criteria |
isFalse(java.lang.String propertyName)
Creates a criterion that asserts the given property is false.
|
DefaultQuery |
isNotEmpty(java.lang.String property)
Used to restrict a value to be not empty (such as a blank string or an empty collection).
|
DefaultQuery |
isNotNull(java.lang.String property)
Used to restrict a property to be not null.
|
DefaultQuery |
isNull(java.lang.String property)
Used to restrict a property to be null.
|
Criteria |
isTrue(java.lang.String propertyName)
Creates a criterion that asserts the given property is true.
|
JoinPath |
join(java.lang.String path,
Association association,
Join.Type joinType,
java.lang.String alias)
Specifies whether a join query should be used (if join queries are supported by the underlying datastore).
|
DefaultQuery |
le(java.lang.String property,
QueryParameter value)
Used to restrict a value to be less than or equal to the given value.
|
Criteria |
leAll(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is less than or equal to all the given returned values.
|
DefaultQuery |
leProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Constrains a property to be less than or equal to a specified other property.
|
Criteria |
leSome(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is less than or equal to some of the given values.
|
DefaultQuery |
like(java.lang.String propertyName,
QueryParameter parameter)
Creates a like Criterion based on the specified property name and value.
|
DefaultQuery |
lt(java.lang.String property,
QueryParameter value)
Used to restrict a value to be less than the given value.
|
Criteria |
ltAll(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is less than all the given returned values.
|
DefaultQuery |
lte(java.lang.String property,
QueryParameter value)
Used to restrict a value to be less than or equal to the given value.
|
DefaultQuery |
ltProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Constrains a property to be less than a specified other property.
|
Criteria |
ltSome(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is less than some of the given values.
|
DefaultQuery |
max(int max)
Defines the maximum number of results to return.
|
Criteria |
ne(java.lang.String propertyName,
QueryParameter parameter)
Creates a "not equals" Criterion based on the specified property name and value.
|
QueryModel.Junction |
negation()
Creates a negation of several criterion.
|
DefaultQuery |
neProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Constrains a property to be not equal to a specified other property.
|
Criteria |
not(Criteria other)
Creates a logical negation.
|
DefaultQuery |
notIn(java.lang.String propertyName,
QueryModel subquery)
Creates a negated "in" Criterion using a subquery.
|
DefaultQuery |
offset(long offset)
Defines the offset (the first result index) of the query.
|
Criteria |
or(Criteria other)
Creates a logical disjunction.
|
DefaultQuery |
or(QueryModel.Criterion a,
QueryModel.Criterion b)
Creates a disjunction using two specified criterion.
|
ProjectionList |
projections() |
DefaultQuery |
rlike(java.lang.String propertyName,
QueryParameter parameter)
Creates an rlike Criterion based on the specified property name and value.
|
DefaultQuery |
sizeEq(java.lang.String propertyName,
QueryParameter size)
Creates a Criterion that constrains a collection property by size.
|
DefaultQuery |
sizeGe(java.lang.String propertyName,
QueryParameter size)
Creates a Criterion that constrains a collection property to be greater than or equal to the given size.
|
DefaultQuery |
sizeGt(java.lang.String propertyName,
QueryParameter size)
Creates a Criterion that constrains a collection property to be greater than the given size.
|
DefaultQuery |
sizeLe(java.lang.String propertyName,
QueryParameter size)
Creates a Criterion that constrains a collection property to be less than or equal to the given size.
|
DefaultQuery |
sizeLt(java.lang.String propertyName,
QueryParameter size)
Creates a Criterion that constrains a collection property to be less than to the given size.
|
DefaultQuery |
sizeNe(java.lang.String propertyName,
QueryParameter size)
Creates a Criterion that constrains a collection property to be not equal to the given size.
|
QueryModel |
sort(Sort sort)
Apply the given sort.
|
Criteria |
startsWith(java.lang.String propertyName,
QueryParameter parameter)
Restricts the property match to strings starting with the given value.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
from, join, join
protected DefaultQuery(@NonNull PersistentEntity entity)
entity
- The entity the query applies to.public java.util.Collection<JoinPath> getJoinPaths()
getJoinPaths
in interface QueryModel
public AssociationQuery createQuery(java.lang.String associationName)
associationName
- The assocation name@NonNull public PersistentEntity getPersistentEntity()
getPersistentEntity
in interface QueryModel
public QueryModel.Junction getCriteria()
getCriteria
in interface QueryModel
@NonNull public java.util.List<QueryModel.Projection> getProjections()
getProjections
in interface QueryModel
public java.util.Optional<JoinPath> getJoinPath(java.lang.String path)
getJoinPath
in interface QueryModel
path
- The path to the associationpublic JoinPath join(@NonNull java.lang.String path, @NonNull Association association, @NonNull Join.Type joinType, java.lang.String alias)
join
in interface QueryModel
association
- The propertypath
- The join pathjoinType
- The join typealias
- The alias to use.public ProjectionList projections()
projections
in interface QueryModel
@NonNull public QueryModel add(@NonNull QueryModel.Criterion criterion)
add
in interface QueryModel
criterion
- The criterion instancepublic PersistentEntity getEntity()
public QueryModel.Junction disjunction()
public QueryModel.Junction conjunction()
public QueryModel.Junction negation()
public DefaultQuery max(int max)
max
in interface QueryModel
max
- The pageSize resultspublic int getMax()
QueryModel
getMax
in interface QueryModel
public long getOffset()
QueryModel
getOffset
in interface QueryModel
public DefaultQuery offset(long offset)
offset
in interface QueryModel
offset
- The offsetpublic Sort getSort()
QueryModel
getSort
in interface QueryModel
@NonNull public QueryModel sort(@NonNull Sort sort)
QueryModel
sort
in interface QueryModel
sort
- The sort to apply@NonNull public DefaultQuery eq(@NonNull java.lang.String property, @NonNull QueryParameter parameter)
@NonNull public DefaultQuery allEq(@NonNull java.util.Map<java.lang.String,QueryParameter> values)
@NonNull public Criteria eqAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
@NonNull public Criteria gtAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
@NonNull public Criteria ltAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
@NonNull public Criteria geAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
@NonNull public Criteria leAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
@NonNull public Criteria gtSome(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
@NonNull public Criteria geSome(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
@NonNull public Criteria ltSome(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
@NonNull public Criteria leSome(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
@NonNull public Criteria idEquals(QueryParameter parameter)
Criteria
@NonNull public DefaultQuery isEmpty(@NonNull java.lang.String property)
@NonNull public DefaultQuery isNotEmpty(@NonNull java.lang.String property)
isNotEmpty
in interface Criteria
property
- The property name@NonNull public DefaultQuery isNull(@NonNull java.lang.String property)
@NonNull public Criteria isTrue(@NonNull java.lang.String propertyName)
Criteria
@NonNull public Criteria isFalse(@NonNull java.lang.String propertyName)
Criteria
@NonNull public DefaultQuery isNotNull(@NonNull java.lang.String property)
@NonNull public DefaultQuery idEq(@NonNull QueryParameter value)
@NonNull public Criteria ne(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
@NonNull public DefaultQuery gt(@NonNull java.lang.String property, @NonNull QueryParameter value)
public DefaultQuery gte(java.lang.String property, QueryParameter value)
public DefaultQuery lte(java.lang.String property, QueryParameter value)
public DefaultQuery ge(java.lang.String property, QueryParameter value)
public DefaultQuery le(java.lang.String property, QueryParameter value)
public DefaultQuery lt(java.lang.String property, QueryParameter value)
@NonNull public DefaultQuery like(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
@NonNull public Criteria startsWith(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
startsWith
in interface Criteria
propertyName
- The property nameparameter
- The parameter that provides the value@NonNull public Criteria endsWith(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
@NonNull public Criteria contains(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
@NonNull public DefaultQuery ilike(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
@NonNull public DefaultQuery rlike(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
@NonNull public Criteria and(@NonNull Criteria other)
Criteria
@NonNull public Criteria or(@NonNull Criteria other)
Criteria
@NonNull public Criteria not(@NonNull Criteria other)
Criteria
@NonNull public DefaultQuery inList(@NonNull java.lang.String propertyName, @NonNull QueryModel subquery)
Criteria
public DefaultQuery inList(java.lang.String property, QueryParameter values)
@NonNull public DefaultQuery notIn(@NonNull java.lang.String propertyName, @NonNull QueryModel subquery)
Criteria
@NonNull public DefaultQuery sizeEq(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
Criteria
@NonNull public DefaultQuery sizeGt(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
Criteria
@NonNull public DefaultQuery sizeGe(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
Criteria
@NonNull public DefaultQuery sizeLe(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
Criteria
@NonNull public DefaultQuery sizeLt(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
Criteria
@NonNull public DefaultQuery sizeNe(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
Criteria
@NonNull public DefaultQuery eqProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
Criteria
eqProperty
in interface Criteria
propertyName
- The propertyotherPropertyName
- The other property@NonNull public DefaultQuery neProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
Criteria
neProperty
in interface Criteria
propertyName
- The propertyotherPropertyName
- The other property@NonNull public DefaultQuery gtProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
Criteria
gtProperty
in interface Criteria
propertyName
- The propertyotherPropertyName
- The other property@NonNull public DefaultQuery geProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
Criteria
geProperty
in interface Criteria
propertyName
- The propertyotherPropertyName
- The other property@NonNull public DefaultQuery ltProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
Criteria
ltProperty
in interface Criteria
propertyName
- The propertyotherPropertyName
- The other property@NonNull public DefaultQuery leProperty(java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
Criteria
leProperty
in interface Criteria
propertyName
- The propertyotherPropertyName
- The other propertypublic DefaultQuery between(java.lang.String property, QueryParameter start, QueryParameter end)
public DefaultQuery and(QueryModel.Criterion a, QueryModel.Criterion b)
a
- The left hand sideb
- The right hand sidepublic DefaultQuery or(QueryModel.Criterion a, QueryModel.Criterion b)
a
- The left hand sideb
- The right hand side