public class MongoFilterFactory extends FilterFactory<MongoConstraint>
MongoQuery
.QueryBuilder.FILTERS
Constructor and Description |
---|
MongoFilterFactory() |
Modifier and Type | Method and Description |
---|---|
protected Object |
customTransform(Object value)
Permits to provive database dependent transformations.
|
protected MongoConstraint |
effectiveAnd(List<MongoConstraint> effectiveConstraints)
Combines the list of constraints using AND
|
protected MongoConstraint |
effectiveOr(List<MongoConstraint> effectiveConstraints)
Combines the list of constraints using OR
|
protected MongoConstraint |
eqValue(Mapping field,
Object value)
Represents field = value as constraint
|
MongoConstraint |
filled(Mapping field)
Generates a constraint which ensures that the given field is filled (not null)
|
protected MongoConstraint |
gtValue(Mapping field,
Object value,
boolean orEqual)
Represents field > value as constraint
|
protected MongoConstraint |
invert(MongoConstraint constraint)
Effectively inverts the given constraint
|
protected MongoConstraint |
ltValue(Mapping field,
Object value,
boolean orEqual)
Represents field < value as constraint
|
MongoConstraint |
nearSphere(Mapping key,
org.bson.Document geometry,
int maxDistanceMeters)
Builds a filter which represents a geospatial query.
|
MongoConstraint |
nearSphere(Mapping key,
double lat,
double lon,
int maxDistanceMeters)
Builds a filter which represents a geospatial query for a point.
|
protected MongoConstraint |
neValue(Mapping field,
Object value)
Represents field !
|
MongoConstraint |
noneInField(Mapping field,
List<Object> values)
Creates a constraint which ensures that the given field doesn't contain any of the given values.
|
MongoConstraint |
notFilled(Mapping field)
Generates a constraint which ensures that the given field is not filled (null)
|
OneInField<MongoConstraint> |
oneInField(Mapping field,
List<Object> values)
Creates a filter builder which ensures that the given field contains at least on of the given values.
|
MongoConstraint |
queryString(EntityDescriptor descriptor,
String query,
List<QueryField> fields)
Compiles the given query for the given entity while searching in the given fields.
|
MongoConstraint |
regex(Mapping key,
Object expression,
String options)
Builds a filter which represents a regex filter for the given field and expression.
|
MongoConstraint |
text(String value)
Executes a $text search in the underlying fulltext index.
|
and, and, containsAll, containsAny, containsNone, containsOne, eq, eqIgnoreEmpty, eqOrEmpty, gt, gte, gteOrEmpty, gtOrEmpty, lt, lte, lteOrEmpty, ltOrEmpty, ne, not, or, or, queryString, transform
protected Object customTransform(Object value)
FilterFactory
customTransform
in class FilterFactory<MongoConstraint>
value
- the value to tranformprotected MongoConstraint eqValue(Mapping field, Object value)
FilterFactory
eqValue
in class FilterFactory<MongoConstraint>
field
- the field to filtervalue
- the value to filter withprotected MongoConstraint neValue(Mapping field, Object value)
FilterFactory
neValue
in class FilterFactory<MongoConstraint>
field
- the field to filtervalue
- the value to filter withprotected MongoConstraint gtValue(Mapping field, Object value, boolean orEqual)
FilterFactory
gtValue
in class FilterFactory<MongoConstraint>
field
- the field to filtervalue
- the value to filter withorEqual
- if true, field >= value is used as comparatorprotected MongoConstraint ltValue(Mapping field, Object value, boolean orEqual)
FilterFactory
ltValue
in class FilterFactory<MongoConstraint>
field
- the field to filtervalue
- the value to filter withorEqual
- if true, field <= value is used as comparatorpublic MongoConstraint filled(Mapping field)
FilterFactory
filled
in class FilterFactory<MongoConstraint>
field
- the field to checkpublic MongoConstraint notFilled(Mapping field)
FilterFactory
notFilled
in class FilterFactory<MongoConstraint>
field
- the field to checkprotected MongoConstraint invert(MongoConstraint constraint)
FilterFactory
invert
in class FilterFactory<MongoConstraint>
constraint
- the constraint to invertprotected MongoConstraint effectiveAnd(List<MongoConstraint> effectiveConstraints)
FilterFactory
effectiveAnd
in class FilterFactory<MongoConstraint>
effectiveConstraints
- the constraints to combine (where each value will be non-null)protected MongoConstraint effectiveOr(List<MongoConstraint> effectiveConstraints)
FilterFactory
effectiveOr
in class FilterFactory<MongoConstraint>
effectiveConstraints
- the constraints to combine (where each value will be non-null)public OneInField<MongoConstraint> oneInField(Mapping field, List<Object> values)
FilterFactory
oneInField
in class FilterFactory<MongoConstraint>
field
- the field to filter onvalues
- the values to checkpublic MongoConstraint noneInField(Mapping field, List<Object> values)
FilterFactory
noneInField
in class FilterFactory<MongoConstraint>
field
- the field to filter onvalues
- the values to checkpublic MongoConstraint queryString(EntityDescriptor descriptor, String query, List<QueryField> fields)
FilterFactory
queryString
in class FilterFactory<MongoConstraint>
descriptor
- the descriptor of the entity being searchedquery
- the query to compilefields
- the default fields to search inpublic MongoConstraint regex(Mapping key, Object expression, String options)
key
- the name of the field to checkexpression
- the regular expression to applyoptions
- the options to apply like "i" to match case insensitivepublic MongoConstraint nearSphere(Mapping key, org.bson.Document geometry, int maxDistanceMeters)
key
- the name of the field to checkgeometry
- the geometry used to filter bymaxDistanceMeters
- the max distance to consider relevantpublic MongoConstraint nearSphere(Mapping key, double lat, double lon, int maxDistanceMeters)
key
- the name of the field to checklat
- the latitude of the point used as search geometry.lon
- the longitude of the point used as search geometry.maxDistanceMeters
- the max distance to consider relevantpublic MongoConstraint text(String value)
value
- the token to search forCopyright © 2018. All rights reserved.