public class Criteria extends Object implements CriteriaDefinition
| Modifier | Constructor and Description |
|---|---|
|
Criteria() |
protected |
Criteria(List<Criteria> criteriaChain,
String key) |
|
Criteria(String key) |
| Modifier and Type | Method and Description |
|---|---|
Criteria |
alike(Example<?> sample)
Creates a criterion using the given object as a pattern.
|
Criteria |
all(Collection<?> o)
Creates a criterion using the $all operator.
|
Criteria |
all(Object... o)
Creates a criterion using the $all operator.
|
Criteria |
and(String key)
Static factory method to create a Criteria using the provided key
|
Criteria |
andOperator(Criteria... criteria)
Creates an 'and' criteria using the $and operator for all of the provided criteria.
|
static Criteria |
byExample(Example<?> example)
Static factory method to create a
Criteria matching an example object. |
static Criteria |
byExample(Object example)
Static factory method to create a
Criteria matching an example object. |
Criteria |
elemMatch(Criteria c)
Creates a criterion using the $elemMatch operator
|
boolean |
equals(Object obj) |
Criteria |
exists(boolean b)
Creates a criterion using the $exists operator.
|
org.bson.Document |
getCriteriaObject()
Get
Document representation. |
String |
getKey()
Get the identifying key.
|
protected org.bson.Document |
getSingleCriteriaObject() |
Criteria |
gt(Object o)
Creates a criterion using the $gt operator.
|
Criteria |
gte(Object o)
Creates a criterion using the $gte operator.
|
int |
hashCode() |
Criteria |
in(Collection<?> c)
Creates a criterion using the $in operator.
|
Criteria |
in(Object... o)
Creates a criterion using the $in operator.
|
Criteria |
intersects(GeoJson geoJson)
Creates criterion using
$geoIntersects operator which matches intersections of the given geoJson
structure and the documents one. |
Criteria |
is(Object o)
Creates a criterion using equality
|
Criteria |
lt(Object o)
Creates a criterion using the $lt operator.
|
Criteria |
lte(Object o)
Creates a criterion using the $lte operator.
|
Criteria |
maxDistance(double maxDistance)
Creates a geo-spatial criterion using a $maxDistance operation, for use with $near
|
Criteria |
minDistance(double minDistance)
Creates a geospatial criterion using a $minDistance operation, for use with $near or
$nearSphere.
|
Criteria |
mod(Number value,
Number remainder)
Creates a criterion using the $mod operator.
|
Criteria |
ne(Object o)
Creates a criterion using the $ne operator.
|
Criteria |
near(Point point)
Creates a geospatial criterion using a $near operation.
|
Criteria |
nearSphere(Point point)
Creates a geospatial criterion using a $nearSphere operation.
|
Criteria |
nin(Collection<?> o)
Creates a criterion using the $nin operator.
|
Criteria |
nin(Object... o)
Creates a criterion using the $nin operator.
|
Criteria |
norOperator(Criteria... criteria)
Creates a 'nor' criteria using the $nor operator for all of the provided criteria.
|
Criteria |
not()
Creates a criterion using the $not meta operator which affects the clause directly following
|
Criteria |
orOperator(Criteria... criteria)
Creates an 'or' criteria using the $or operator for all of the provided criteria
Note that mongodb doesn't support an $or operator to be wrapped in a $not operator.
|
Criteria |
regex(org.bson.BsonRegularExpression regex) |
Criteria |
regex(Pattern pattern)
Syntactical sugar for
is(Object) making obvious that we create a regex predicate. |
Criteria |
regex(String re)
Creates a criterion using a $regex operator.
|
Criteria |
regex(String re,
String options)
Creates a criterion using a $regex and $options operator.
|
Criteria |
size(int s)
Creates a criterion using the $size operator.
|
Criteria |
type(int t)
Creates a criterion using the $type operator.
|
static Criteria |
where(String key)
Static factory method to create a Criteria using the provided key
|
Criteria |
within(Shape shape)
Creates a geospatial criterion using a $geoWithin operation.
|
Criteria |
withinSphere(Circle circle)
Creates a geospatial criterion using a $geoWithin $centerSphere operation.
|
public Criteria()
public Criteria(String key)
public static Criteria where(String key)
key - public static Criteria byExample(Object example)
Criteria matching an example object.example - must not be null.alike(Example)public static Criteria byExample(Example<?> example)
Criteria matching an example object.example - must not be null.alike(Example)public Criteria and(String key)
public Criteria is(@Nullable Object o)
o - public Criteria ne(@Nullable Object o)
o - public Criteria lt(Object o)
o - public Criteria lte(Object o)
o - public Criteria gt(Object o)
o - public Criteria gte(Object o)
o - public Criteria in(Object... o)
o - the values to match againstpublic Criteria in(Collection<?> c)
c - the collection containing the values to match againstpublic Criteria nin(Object... o)
o - public Criteria nin(Collection<?> o)
o - public Criteria mod(Number value, Number remainder)
value - remainder - public Criteria all(Object... o)
o - public Criteria all(Collection<?> o)
o - public Criteria size(int s)
s - public Criteria exists(boolean b)
b - public Criteria type(int t)
t - public Criteria not()
public Criteria regex(String re)
re - public Criteria regex(String re, @Nullable String options)
re - options - public Criteria regex(Pattern pattern)
is(Object) making obvious that we create a regex predicate.pattern - public Criteria regex(org.bson.BsonRegularExpression regex)
public Criteria withinSphere(Circle circle)
circle - must not be nullpublic Criteria within(Shape shape)
shape - public Criteria near(Point point)
point - must not be nullpublic Criteria nearSphere(Point point)
point - must not be nullpublic Criteria intersects(GeoJson geoJson)
$geoIntersects operator which matches intersections of the given geoJson
structure and the documents one. Requires MongoDB 2.4 or better.geoJson - must not be null.public Criteria maxDistance(double maxDistance)
maxDistance - public Criteria minDistance(double minDistance)
minDistance - public Criteria elemMatch(Criteria c)
c - public Criteria alike(Example<?> sample)
sample - public Criteria orOperator(Criteria... criteria)
Note that mongodb doesn't support an $or operator to be wrapped in a $not operator.
criteria - IllegalArgumentException - if orOperator(Criteria...) follows a not() call directly.public Criteria norOperator(Criteria... criteria)
Note that mongodb doesn't support an $nor operator to be wrapped in a $not operator.
criteria - IllegalArgumentException - if norOperator(Criteria...) follows a not() call directly.public Criteria andOperator(Criteria... criteria)
Note that mongodb doesn't support an $and operator to be wrapped in a $not operator.
criteria - IllegalArgumentException - if andOperator(Criteria...) follows a not() call directly.@Nullable public String getKey()
CriteriaDefinitiongetKey in interface CriteriaDefinitionpublic org.bson.Document getCriteriaObject()
CriteriaDefinitionDocument representation.getCriteriaObject in interface CriteriaDefinitionprotected org.bson.Document getSingleCriteriaObject()
Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.