Package org.dizitart.no2.filters
Interface Filter
- All Known Implementing Classes:
ComparableFilter,FieldBasedFilter,IndexOnlyFilter,IndexScanFilter,LogicalFilter,NitriteFilter,SortingAwareFilter,StringFilter
public interface Filter
An interface to specify filtering criteria during find operation. When
a filter is applied to a collection, based on the criteria it returns
a set of matching records.
Each filtering criteria is based on a field of a document. If the field is indexed, the find operation takes the advantage of it and only scans the index map for that field. But if the field is not indexed, it scans the whole collection.
- Since:
- 1.0
- Author:
- Anindya Chatterjee
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic FilterCreates a filter that performs a logical AND operation on two or more filters.booleanApplies the filter to the given element.static FilterReturns a filter that matches documents with the specified NitriteId.default Filternot()Creates a not filter which performs a logical NOT operation on a filter and selects the documents that do not satisfy the criteria.static FilterCreates a filter that performs a logical OR operation on two or more filters.
-
Field Details
-
ALL
A filter to select all elements.
-
-
Method Details
-
byId
Returns a filter that matches documents with the specified NitriteId.The returned filter matches documents where the value of the _id field is equal to the specified NitriteId's idValue.
- Parameters:
nitriteId- the nitrite id- Returns:
- the filter
-
and
Creates a filter that performs a logical AND operation on two or more filters. The returned filter accepts a document if all filters in the list accept the document.- Parameters:
filters- the filters to AND together- Returns:
- the new filter
- Throws:
FilterException- if less than two filters are specified
-
or
Creates a filter that performs a logical OR operation on two or more filters. The returned filter selects all documents that satisfy at least one of the filters in the list.- Parameters:
filters- the filters to be combined using the OR operation- Returns:
- the filter that performs the OR operation on the specified filters
- Throws:
FilterException- if less than two filters are specified
-
apply
Applies the filter to the given element.- Parameters:
element- the element to apply the filter to.- Returns:
trueif the element matches the filter,falseotherwise.
-
not
Creates a not filter which performs a logical NOT operation on a filter and selects the documents that do not satisfy the criteria.NOTE: This also includes documents that do not contain the value.
- Returns:
- the not filter
-