Package dev.morphia.query
Class FieldEndImpl<T extends CriteriaContainer>
- java.lang.Object
-
- dev.morphia.query.FieldEndImpl<T>
-
- Type Parameters:
T
- the type of the CriteriaContainer
- All Implemented Interfaces:
FieldEnd<T>
public class FieldEndImpl<T extends CriteriaContainer> extends java.lang.Object implements FieldEnd<T>
Represents a document field in a query and presents the operations available to querying against that field. This is an internal class and subject to change without notice.
-
-
Constructor Summary
Constructors Constructor Description FieldEndImpl(QueryImpl<?> query, java.lang.String field, T target)
Creates a FieldEnd for a particular field.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description T
contains(java.lang.String string)
Checks if a field contains a valueT
containsIgnoreCase(java.lang.String string)
Checks if a field contains a value ignoring the case of the valuesT
doesNotExist()
Checks that a field does not exist in a documentT
doesNotHaveThisElement(java.lang.Object val)
Deprecated.T
elemMatch(Query query)
Checks that a field matches the provided query definitionT
endsWith(java.lang.String suffix)
Checks that a field ends with a valueT
endsWithIgnoreCase(java.lang.String suffix)
Checks that a field ends with a value ignoring the case of the valuesT
equal(java.lang.Object val)
Checks that a field equals a valueT
equalIgnoreCase(java.lang.Object val)
Checks that a field equals a valueT
exists()
Checks that a field exists in a documentT
greaterThan(java.lang.Object val)
Checks that a field is greater than the value givenT
greaterThanOrEq(java.lang.Object val)
Checks that a field is greater than or equal to the value givenT
hasAllOf(java.lang.Iterable<?> values)
Checks that a field has all of the values listed.T
hasAnyOf(java.lang.Iterable<?> values)
Checks that a field has any of the values listed.T
hasNoneOf(java.lang.Iterable<?> values)
Checks that a field has none of the values listed.T
hasThisElement(java.lang.Object val)
Deprecated.T
hasThisOne(java.lang.Object val)
Checks that a field has the value listed.T
in(java.lang.Iterable<?> values)
Synonym forFieldEnd.hasAnyOf(Iterable)
T
intersects(Geometry geometry)
This performs a $geoIntersects query, searching documents containing any sort of GeoJson field and returning those where the given geometry intersects with the document shape.T
intersects(Geometry geometry, CoordinateReferenceSystem crs)
This performs a $geoIntersects query, searching documents containing any sort of GeoJson field and returning those where the given geometry intersects with the document shape.T
lessThan(java.lang.Object val)
Checks that a field is less than the value givenT
lessThanOrEq(java.lang.Object val)
Checks that a field is less than or equal to the value givenT
mod(long divisor, long remainder)
Select documents where the value of a field divided by a divisor has the specified remainder (i.e.T
near(double longitude, double latitude)
Specifies a point for which a geospatial query returns the documents from nearest to farthest.T
near(double longitude, double latitude, boolean spherical)
Specifies a point for which a geospatial query returns the documents from nearest to farthest.T
near(double longitude, double latitude, double radius)
Specifies a point for which a geospatial query returns the documents from nearest to farthest.T
near(double longitude, double latitude, double radius, boolean spherical)
Specifies a point for which a geospatial query returns the documents from nearest to farthest.T
near(Point point)
This runs a $near query to check for documents geographically close to the given Point - this Point represents a GeoJSON point type.T
near(Point point, int maxDistance)
This runs a $near query to check for documents geographically close to the given Point - this Point represents a GeoJSON point type.T
near(Point point, java.lang.Double maxDistance, java.lang.Double minDistance)
Specifies a point for which a geospatial query returns the documents from nearest to farthest.T
nearSphere(Point point)
Specifies a point for which a geospatial query returns the documents from nearest to farthest.T
nearSphere(Point point, java.lang.Double maxDistance, java.lang.Double minDistance)
Specifies a point for which a geospatial query returns the documents from nearest to farthest.FieldEnd<T>
not()
Negates the criteria applied to the fieldT
notEqual(java.lang.Object val)
Checks that a field doesn't equal a valueT
notIn(java.lang.Iterable<?> values)
Synonym forFieldEnd.hasNoneOf(Iterable)
T
sizeEq(int val)
Checks the size of a field.T
startsWith(java.lang.String prefix)
Checks that a field starts with a valueT
startsWithIgnoreCase(java.lang.String prefix)
Checks that a field starts with a value ignoring the case of the valuesT
type(Type type)
Checks the type of a fieldT
within(MultiPolygon boundaries)
This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundaries.T
within(MultiPolygon boundaries, CoordinateReferenceSystem crs)
This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundaries.T
within(Polygon boundary)
This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundary.T
within(Polygon boundary, CoordinateReferenceSystem crs)
This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundary.T
within(Shape shape)
This implements the $geoWithin operator and is only compatible with mongo 2.4 or greater.
-
-
-
Method Detail
-
contains
public T contains(java.lang.String string)
Description copied from interface:FieldEnd
Checks if a field contains a value- Specified by:
contains
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
string
- the value to check for- Returns:
- T
-
containsIgnoreCase
public T containsIgnoreCase(java.lang.String string)
Description copied from interface:FieldEnd
Checks if a field contains a value ignoring the case of the values- Specified by:
containsIgnoreCase
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
string
- the value to check for- Returns:
- T
-
doesNotExist
public T doesNotExist()
Description copied from interface:FieldEnd
Checks that a field does not exist in a document- Specified by:
doesNotExist
in interfaceFieldEnd<T extends CriteriaContainer>
- Returns:
- T
-
endsWith
public T endsWith(java.lang.String suffix)
Description copied from interface:FieldEnd
Checks that a field ends with a value- Specified by:
endsWith
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
suffix
- the value to check- Returns:
- T
-
endsWithIgnoreCase
public T endsWithIgnoreCase(java.lang.String suffix)
Description copied from interface:FieldEnd
Checks that a field ends with a value ignoring the case of the values- Specified by:
endsWithIgnoreCase
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
suffix
- the value to check- Returns:
- T
-
equal
public T equal(java.lang.Object val)
Description copied from interface:FieldEnd
Checks that a field equals a value- Specified by:
equal
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
val
- the value to check- Returns:
- T
-
equalIgnoreCase
public T equalIgnoreCase(java.lang.Object val)
Description copied from interface:FieldEnd
Checks that a field equals a value- Specified by:
equalIgnoreCase
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
val
- the value to check- Returns:
- T
-
exists
public T exists()
Description copied from interface:FieldEnd
Checks that a field exists in a document- Specified by:
exists
in interfaceFieldEnd<T extends CriteriaContainer>
- Returns:
- T
-
greaterThan
public T greaterThan(java.lang.Object val)
Description copied from interface:FieldEnd
Checks that a field is greater than the value given- Specified by:
greaterThan
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
val
- the value to check against- Returns:
- T
-
greaterThanOrEq
public T greaterThanOrEq(java.lang.Object val)
Description copied from interface:FieldEnd
Checks that a field is greater than or equal to the value given- Specified by:
greaterThanOrEq
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
val
- the value to check against- Returns:
- T
-
hasAllOf
public T hasAllOf(java.lang.Iterable<?> values)
Description copied from interface:FieldEnd
Checks that a field has all of the values listed.- Specified by:
hasAllOf
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
values
- the values to check against- Returns:
- T
-
hasAnyOf
public T hasAnyOf(java.lang.Iterable<?> values)
Description copied from interface:FieldEnd
Checks that a field has any of the values listed.- Specified by:
hasAnyOf
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
values
- the values to check against- Returns:
- T
-
hasNoneOf
public T hasNoneOf(java.lang.Iterable<?> values)
Description copied from interface:FieldEnd
Checks that a field has none of the values listed.- Specified by:
hasNoneOf
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
values
- the values to check against- Returns:
- T
-
doesNotHaveThisElement
@Deprecated public T doesNotHaveThisElement(java.lang.Object val)
Deprecated.Description copied from interface:FieldEnd
Checks that a field does not have the value listed. The options to store null/empty values apply here so to do partial matches on embedded objects, pass a reference to a partially populated instance with only the values of interest set to the values to check.- Specified by:
doesNotHaveThisElement
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
val
- the value to check against- Returns:
- T
- See Also:
MapperOptions
-
hasThisElement
@Deprecated public T hasThisElement(java.lang.Object val)
Deprecated.Description copied from interface:FieldEnd
Checks that a field has the value listed. The options to store null/empty values apply here so to do partial matches on embedded objects, pass a reference to a partially populated instance with only the values of interest set to the values to check.- Specified by:
hasThisElement
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
val
- the value to check against- Returns:
- T
- See Also:
MapperOptions
-
elemMatch
public T elemMatch(Query query)
Description copied from interface:FieldEnd
Checks that a field matches the provided query definition- Specified by:
elemMatch
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
query
- the query to find certain field values- Returns:
- T
-
hasThisOne
public T hasThisOne(java.lang.Object val)
Description copied from interface:FieldEnd
Checks that a field has the value listed.- Specified by:
hasThisOne
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
val
- the value to check against- Returns:
- T
-
in
public T in(java.lang.Iterable<?> values)
Description copied from interface:FieldEnd
Synonym forFieldEnd.hasAnyOf(Iterable)
- Specified by:
in
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
values
- the values to check against- Returns:
- T
-
intersects
public T intersects(Geometry geometry)
Description copied from interface:FieldEnd
This performs a $geoIntersects query, searching documents containing any sort of GeoJson field and returning those where the given geometry intersects with the document shape. This includes cases where the data and the specified object share an edge.- Specified by:
intersects
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
geometry
- the shape to use to query for any stored shapes that intersect- Returns:
- T
-
intersects
public T intersects(Geometry geometry, CoordinateReferenceSystem crs)
Description copied from interface:FieldEnd
This performs a $geoIntersects query, searching documents containing any sort of GeoJson field and returning those where the given geometry intersects with the document shape. This includes cases where the data and the specified object share an edge.- Specified by:
intersects
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
geometry
- the shape to use to query for any stored shapes that intersectcrs
- the coordinate reference system to use with the query- Returns:
- T
-
lessThan
public T lessThan(java.lang.Object val)
Description copied from interface:FieldEnd
Checks that a field is less than the value given- Specified by:
lessThan
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
val
- the value to check against- Returns:
- T
-
lessThanOrEq
public T lessThanOrEq(java.lang.Object val)
Description copied from interface:FieldEnd
Checks that a field is less than or equal to the value given- Specified by:
lessThanOrEq
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
val
- the value to check against- Returns:
- T
-
mod
public T mod(long divisor, long remainder)
Description copied from interface:FieldEnd
Select documents where the value of a field divided by a divisor has the specified remainder (i.e. perform a modulo operation to select documents)- Specified by:
mod
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
divisor
- the divisor to applyremainder
- the remainder to check for- Returns:
- T
-
near
public T near(double longitude, double latitude)
Description copied from interface:FieldEnd
Specifies a point for which a geospatial query returns the documents from nearest to farthest.- Specified by:
near
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
longitude
- the longitudelatitude
- the latitude- Returns:
- T
-
near
public T near(double longitude, double latitude, boolean spherical)
Description copied from interface:FieldEnd
Specifies a point for which a geospatial query returns the documents from nearest to farthest.- Specified by:
near
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
longitude
- the longitudelatitude
- the latitudespherical
- if true, will use spherical geometry ($nearSphere) when analyzing documents- Returns:
- T
-
near
public T near(double longitude, double latitude, double radius)
Description copied from interface:FieldEnd
Specifies a point for which a geospatial query returns the documents from nearest to farthest.- Specified by:
near
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
longitude
- the longitudelatitude
- the latituderadius
- the max distance to consider- Returns:
- T
-
near
public T near(double longitude, double latitude, double radius, boolean spherical)
Description copied from interface:FieldEnd
Specifies a point for which a geospatial query returns the documents from nearest to farthest.- Specified by:
near
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
longitude
- the longitudelatitude
- the latituderadius
- the max distance to considerspherical
- if true, will use spherical geometry ($nearSphere) when analyzing documents- Returns:
- T
-
near
public T near(Point point, int maxDistance)
Description copied from interface:FieldEnd
This runs a $near query to check for documents geographically close to the given Point - this Point represents a GeoJSON point type. These queries are only supported by MongoDB version 2.4 or greater.- Specified by:
near
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
point
- the point to find results close tomaxDistance
- the radius, in meters, to find the results inside- Returns:
- T
-
near
public T near(Point point)
Description copied from interface:FieldEnd
This runs a $near query to check for documents geographically close to the given Point - this Point represents a GeoJSON point type. These queries are only supported by MongoDB version 2.4 or greater.- Specified by:
near
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
point
- the point to find results close to- Returns:
- T
-
near
public T near(Point point, java.lang.Double maxDistance, java.lang.Double minDistance)
Description copied from interface:FieldEnd
Specifies a point for which a geospatial query returns the documents from nearest to farthest.- Specified by:
near
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
point
- the point to find results close tomaxDistance
- the maximum distance in meters from the pointminDistance
- the minimum distance in meters from the point- Returns:
- T
-
nearSphere
public T nearSphere(Point point)
Description copied from interface:FieldEnd
Specifies a point for which a geospatial query returns the documents from nearest to farthest.- Specified by:
nearSphere
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
point
- the point to find results close to- Returns:
- T
-
nearSphere
public T nearSphere(Point point, java.lang.Double maxDistance, java.lang.Double minDistance)
Description copied from interface:FieldEnd
Specifies a point for which a geospatial query returns the documents from nearest to farthest.- Specified by:
nearSphere
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
point
- the point to find results close tomaxDistance
- the maximum distance in meters from the pointminDistance
- the minimum distance in meters from the point- Returns:
- T
-
not
public FieldEnd<T> not()
Description copied from interface:FieldEnd
Negates the criteria applied to the field- Specified by:
not
in interfaceFieldEnd<T extends CriteriaContainer>
- Returns:
- this
-
notEqual
public T notEqual(java.lang.Object val)
Description copied from interface:FieldEnd
Checks that a field doesn't equal a value- Specified by:
notEqual
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
val
- the value to check- Returns:
- T
-
notIn
public T notIn(java.lang.Iterable<?> values)
Description copied from interface:FieldEnd
Synonym forFieldEnd.hasNoneOf(Iterable)
- Specified by:
notIn
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
values
- the values to check against- Returns:
- T
-
sizeEq
public T sizeEq(int val)
Description copied from interface:FieldEnd
Checks the size of a field.- Specified by:
sizeEq
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
val
- the value to check against- Returns:
- T
-
startsWith
public T startsWith(java.lang.String prefix)
Description copied from interface:FieldEnd
Checks that a field starts with a value- Specified by:
startsWith
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
prefix
- the value to check- Returns:
- T
-
startsWithIgnoreCase
public T startsWithIgnoreCase(java.lang.String prefix)
Description copied from interface:FieldEnd
Checks that a field starts with a value ignoring the case of the values- Specified by:
startsWithIgnoreCase
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
prefix
- the value to check- Returns:
- T
-
type
public T type(Type type)
Description copied from interface:FieldEnd
Checks the type of a field- Specified by:
type
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
type
- the value to check against- Returns:
- T
-
within
public T within(Shape shape)
Description copied from interface:FieldEnd
This implements the $geoWithin operator and is only compatible with mongo 2.4 or greater.- Specified by:
within
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
shape
- the shape to check within- Returns:
- T
-
within
public T within(Polygon boundary)
Description copied from interface:FieldEnd
This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundary. When determining inclusion, MongoDB considers the border of a shape to be part of the shape, subject to the precision of floating point numbers.- Specified by:
within
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
boundary
- a polygon describing the boundary to search within.- Returns:
- T
-
within
public T within(MultiPolygon boundaries)
Description copied from interface:FieldEnd
This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundaries. When determining inclusion, MongoDB considers the border of a shape to be part of the shape, subject to the precision of floating point numbers.- Specified by:
within
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
boundaries
- a multi-polygon describing the areas to search within.- Returns:
- T
-
within
public T within(Polygon boundary, CoordinateReferenceSystem crs)
Description copied from interface:FieldEnd
This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundary. When determining inclusion, MongoDB considers the border of a shape to be part of the shape, subject to the precision of floating point numbers.- Specified by:
within
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
boundary
- a polygon describing the boundary to search within.crs
- the coordinate reference system to use- Returns:
- T
-
within
public T within(MultiPolygon boundaries, CoordinateReferenceSystem crs)
Description copied from interface:FieldEnd
This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundaries. When determining inclusion, MongoDB considers the border of a shape to be part of the shape, subject to the precision of floating point numbers. These queries are only compatible with MongoDB 2.6 or greater.- Specified by:
within
in interfaceFieldEnd<T extends CriteriaContainer>
- Parameters:
boundaries
- a multi-polygon describing the areas to search within.crs
- the coordinate reference system to use- Returns:
- T
-
-