Class FluentFilter

java.lang.Object
org.dizitart.no2.filters.FluentFilter

public final class FluentFilter extends Object
A fluent api for the NitriteFilter.
Since:
4.0
Author:
Anindya Chatterjee.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The where clause for elemMatch filter.
  • Method Summary

    Modifier and Type
    Method
    Description
    between(Comparable<?> lowerBound, Comparable<?> upperBound)
    Creates a filter that matches documents where the value of the field is between the specified lower and upper bounds.
    between(Comparable<?> lowerBound, Comparable<?> upperBound, boolean inclusive)
    Creates a filter that matches documents where the value of the field is between the given lower and upper bounds.
    between(Comparable<?> lowerBound, Comparable<?> upperBound, boolean lowerInclusive, boolean upperInclusive)
    Creates a filter that matches documents where the value of a field is between two specified values.
    elemMatch(Filter filter)
    Creates a filter that matches documents where the value of a field contains at least one element that matches the specified filter.
    eq(Object value)
    Creates an equality filter that matches documents where the value of a field equals the specified value.
    gt(Comparable<?> value)
    Creates a filter that matches all documents where the value of the specified field is greater than the given value.
    gte(Comparable<?> value)
    Creates a filter that matches documents where the value of the field is greater than or equal to the specified value.
    in(Comparable<?>... values)
    Creates a filter that matches documents where the value of the field is in the specified array of values.
    lt(Comparable<?> value)
    Creates a filter that matches documents where the value of the field is less than the specified value.
    lte(Comparable<?> value)
    Creates a filter that matches documents where the value of the field is less than or equal to the specified value.
    notEq(Object value)
    Creates a filter that matches all documents where the value of the specified field is not equal to the given value.
    notIn(Comparable<?>... values)
    Creates a filter that matches documents where the value of the field is not in the specified array of values.
    regex(String value)
    Creates a filter that matches documents where the value of the specified field matches the specified regular expression pattern.
    text(String value)
    Creates a filter which performs a text search on the content of the fields indexed with a full-text index.
    where(String field)
    Creates a new FluentFilter instance with the specified field name.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • $

      public static FluentFilter $
      The where clause for elemMatch filter.
  • Method Details

    • where

      public static FluentFilter where(String field)
      Creates a new FluentFilter instance with the specified field name.
      Parameters:
      field - the name of the field to filter on
      Returns:
      a new FluentFilter instance with the specified field name
    • eq

      public NitriteFilter eq(Object value)
      Creates an equality filter that matches documents where the value of a field equals the specified value.
      Parameters:
      value - the value to match against.
      Returns:
      a NitriteFilter instance representing the equality filter.
    • notEq

      public NitriteFilter notEq(Object value)
      Creates a filter that matches all documents where the value of the specified field is not equal to the given value.
      Parameters:
      value - the value to compare against.
      Returns:
      a NitriteFilter instance.
    • gt

      public NitriteFilter gt(Comparable<?> value)
      Creates a filter that matches all documents where the value of the specified field is greater than the given value.
      Parameters:
      value - the value to compare against.
      Returns:
      the NitriteFilter instance representing the greater than filter.
    • gte

      public NitriteFilter gte(Comparable<?> value)
      Creates a filter that matches documents where the value of the field is greater than or equal to the specified value.
      Parameters:
      value - the value to compare against.
      Returns:
      a filter that matches documents where the value of the field is greater than or equal to the specified value.
    • lt

      public NitriteFilter lt(Comparable<?> value)
      Creates a filter that matches documents where the value of the field is less than the specified value.
      Parameters:
      value - the value to compare against.
      Returns:
      a filter that matches documents where the value of the field is less than the specified value.
    • lte

      public NitriteFilter lte(Comparable<?> value)
      Creates a filter that matches documents where the value of the field is less than or equal to the specified value.
      Parameters:
      value - the value to compare against.
      Returns:
      a filter that matches documents where the value of the field is less than or equal to the specified value.
    • between

      public NitriteFilter between(Comparable<?> lowerBound, Comparable<?> upperBound)
      Creates a filter that matches documents where the value of the field is between the specified lower and upper bounds.
      Parameters:
      lowerBound - the lower bound (inclusive) of the range to match.
      upperBound - the upper bound (inclusive) of the range to match.
      Returns:
      a filter that matches documents where the value of the field is between the specified lower and upper bounds.
    • between

      public NitriteFilter between(Comparable<?> lowerBound, Comparable<?> upperBound, boolean inclusive)
      Creates a filter that matches documents where the value of the field is between the given lower and upper bounds.
      Parameters:
      lowerBound - the lower bound of the range (inclusive).
      upperBound - the upper bound of the range (inclusive).
      inclusive - whether the bounds are inclusive or not.
      Returns:
      a filter that matches documents where the value of the field is between the given lower and upper bounds.
    • between

      public NitriteFilter between(Comparable<?> lowerBound, Comparable<?> upperBound, boolean lowerInclusive, boolean upperInclusive)
      Creates a filter that matches documents where the value of a field is between two specified values.
      Parameters:
      lowerBound - the lower bound (inclusive) of the range
      upperBound - the upper bound (inclusive) of the range
      lowerInclusive - true if the lower bound is inclusive, false otherwise
      upperInclusive - true if the upper bound is inclusive, false otherwise
      Returns:
      a filter that matches documents where the value of a field is between two specified values
    • text

      public NitriteFilter text(String value)
      Creates a filter which performs a text search on the content of the fields indexed with a full-text index.
      Parameters:
      value - the text value
      Returns:
      the text filter
      See Also:
    • regex

      public NitriteFilter regex(String value)
      Creates a filter that matches documents where the value of the specified field matches the specified regular expression pattern.
      Parameters:
      value - the regular expression pattern to match against the value of the specified field
      Returns:
      a filter that matches documents where the value of the specified field matches the specified regular expression pattern
    • in

      public NitriteFilter in(Comparable<?>... values)
      Creates a filter that matches documents where the value of the field is in the specified array of values.
      Parameters:
      values - the array of values to match against
      Returns:
      the filter object representing the filter
    • notIn

      public NitriteFilter notIn(Comparable<?>... values)
      Creates a filter that matches documents where the value of the field is not in the specified array of values.
      Parameters:
      values - the array of values to compare against
      Returns:
      a filter that matches documents where the value of the field is not in the specified array of values
    • elemMatch

      public NitriteFilter elemMatch(Filter filter)
      Creates a filter that matches documents where the value of a field contains at least one element that matches the specified filter.
      Parameters:
      filter - the filter to apply to the matching elements
      Returns:
      a filter that matches documents where the value of a field contains at least one element that matches the specified filter