Package dev.morphia.query.filters
Class Filter
- java.lang.Object
-
- dev.morphia.query.filters.Filter
-
- Direct Known Subclasses:
GeoIntersectsFilter,GeoWithinFilter,LogicalFilter,NearFilter,RegexFilter,TextSearchFilter
public class Filter extends Object
Base class for query filters- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidencode(Datastore datastore, BsonWriter writer, EncoderContext context)FilterentityType(Class<?> type)Sets the query entity type on the filterStringgetField()StringgetName()ObjectgetValue()protected ObjectgetValue(Datastore datastore)booleanisNot()FilterisValidating(boolean validate)Sets whether to validate field names or notFilternot()Negates this filter by wrapping in "$not: {}"protected Stringpath(Mapper mapper)protected voidsetValue(Object value)StringtoString()protected voidwriteNamedValue(String name, Object value, Datastore datastore, BsonWriter writer, EncoderContext encoderContext)protected voidwriteUnnamedValue(Object value, Datastore datastore, BsonWriter writer, EncoderContext encoderContext)
-
-
-
Method Detail
-
isNot
@MorphiaInternal public boolean isNot()
- Returns:
- true if this filter has been notted
- See Also:
not()
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
encode
@MorphiaInternal public void encode(Datastore datastore, BsonWriter writer, EncoderContext context)
- Parameters:
datastore- the datastorewriter- the writercontext- the context
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
entityType
@MorphiaInternal public Filter entityType(Class<?> type)
Sets the query entity type on the filter- Parameters:
type- the type- Returns:
- this
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getField
@Nullable @MorphiaInternal public String getField()
- Returns:
- the filter field
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
not
public Filter not()
Negates this filter by wrapping in "$not: {}"- Returns:
- this
- MongoDB documentation
- Query Filter: $not
-
getName
@Nullable @MorphiaInternal public String getName()
- Returns:
- the filter name
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getValue
@Nullable @MorphiaInternal public Object getValue()
- Returns:
- the filter value
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
setValue
protected void setValue(Object value)
-
isValidating
@MorphiaInternal public Filter isValidating(boolean validate)
Sets whether to validate field names or not- Parameters:
validate- true to validate- Returns:
- this
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
writeNamedValue
protected void writeNamedValue(@Nullable String name, @Nullable Object value, Datastore datastore, BsonWriter writer, EncoderContext encoderContext)
-
writeUnnamedValue
protected void writeUnnamedValue(@Nullable Object value, Datastore datastore, BsonWriter writer, EncoderContext encoderContext)
-
-