Class Criteria

  • All Implemented Interfaces:
    Predicate

    public class Criteria
    extends java.lang.Object
    implements Predicate
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      Criteria all​(java.lang.Object... o)
      The all operator is similar to $in, but instead of matching any value in the specified array all values in the array must be matched.
      Criteria all​(java.util.Collection<?> c)
      The all operator is similar to $in, but instead of matching any value in the specified array all values in the array must be matched.
      Criteria and​(java.lang.String key)
      Static factory method to create a Criteria using the provided key
      boolean apply​(Predicate.PredicateContext ctx)  
      private void checkComplete()  
      Criteria contains​(java.lang.Object o)
      The contains operator asserts that the provided object is contained in the result.
      static Criteria create​(java.lang.String left, java.lang.String operator, java.lang.String right)
      Deprecated.
      Criteria empty​(boolean empty)
      The notEmpty operator checks that an array or String is empty.
      Criteria eq​(java.lang.Object o)
      Creates a criterion using equality
      Criteria exists​(boolean shouldExist)
      Check for existence (or lack thereof) of a field.
      Criteria gt​(java.lang.Object o)
      Creates a criterion using the > operator
      Criteria gte​(java.lang.Object o)
      Creates a criterion using the >= operator
      Criteria in​(java.lang.Object... o)
      The in operator is analogous to the SQL IN modifier, allowing you to specify an array of possible matches.
      Criteria in​(java.util.Collection<?> c)
      The in operator is analogous to the SQL IN modifier, allowing you to specify an array of possible matches.
      Criteria is​(java.lang.Object o)
      Creates a criterion using equality
      Criteria lt​(java.lang.Object o)
      Creates a criterion using the < operator
      Criteria lte​(java.lang.Object o)
      Creates a criterion using the <= operator
      Criteria matches​(Predicate p)
      The matches operator checks that an object matches the given predicate.
      Criteria ne​(java.lang.Object o)
      Creates a criterion using the != operator
      Criteria nin​(java.lang.Object... o)
      The nin operator is similar to $in except that it selects objects for which the specified field does not have any value in the specified array.
      Criteria nin​(java.util.Collection<?> c)
      The nin operator is similar to $in except that it selects objects for which the specified field does not have any value in the specified array.
      Criteria notEmpty()
      Deprecated.
      static Criteria parse​(java.lang.String criteria)
      Deprecated.
      private static java.lang.String prefixPath​(java.lang.String key)  
      Criteria regex​(java.util.regex.Pattern pattern)
      Creates a criterion using a Regex
      Criteria size​(int size)
      The size operator matches:
      private java.util.Collection<RelationalExpressionNode> toRelationalExpressionNodes()  
      java.lang.String toString()  
      Criteria type​(java.lang.Class<?> clazz)
      The $type operator matches values based on their Java JSON type.
      static Criteria where​(Path key)
      Deprecated.
      static Criteria where​(java.lang.String key)
      Static factory method to create a Criteria using the provided key
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Criteria

        private Criteria​(java.util.List<Criteria> criteriaChain,
                         ValueNode left)
      • Criteria

        private Criteria​(ValueNode left)
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • where

        @Deprecated
        public static Criteria where​(Path key)
        Deprecated.
        Static factory method to create a Criteria using the provided key
        Parameters:
        key - filed name
        Returns:
        the new criteria
      • where

        public static Criteria where​(java.lang.String key)
        Static factory method to create a Criteria using the provided key
        Parameters:
        key - filed name
        Returns:
        the new criteria
      • and

        public Criteria and​(java.lang.String key)
        Static factory method to create a Criteria using the provided key
        Parameters:
        key - ads new filed to criteria
        Returns:
        the criteria builder
      • is

        public Criteria is​(java.lang.Object o)
        Creates a criterion using equality
        Parameters:
        o -
        Returns:
        the criteria
      • eq

        public Criteria eq​(java.lang.Object o)
        Creates a criterion using equality
        Parameters:
        o -
        Returns:
        the criteria
      • ne

        public Criteria ne​(java.lang.Object o)
        Creates a criterion using the != operator
        Parameters:
        o -
        Returns:
        the criteria
      • lt

        public Criteria lt​(java.lang.Object o)
        Creates a criterion using the < operator
        Parameters:
        o -
        Returns:
        the criteria
      • lte

        public Criteria lte​(java.lang.Object o)
        Creates a criterion using the <= operator
        Parameters:
        o -
        Returns:
        the criteria
      • gt

        public Criteria gt​(java.lang.Object o)
        Creates a criterion using the > operator
        Parameters:
        o -
        Returns:
        the criteria
      • gte

        public Criteria gte​(java.lang.Object o)
        Creates a criterion using the >= operator
        Parameters:
        o -
        Returns:
        the criteria
      • regex

        public Criteria regex​(java.util.regex.Pattern pattern)
        Creates a criterion using a Regex
        Parameters:
        pattern -
        Returns:
        the criteria
      • in

        public Criteria in​(java.lang.Object... o)
        The in operator is analogous to the SQL IN modifier, allowing you to specify an array of possible matches.
        Parameters:
        o - the values to match against
        Returns:
        the criteria
      • in

        public Criteria in​(java.util.Collection<?> c)
        The in operator is analogous to the SQL IN modifier, allowing you to specify an array of possible matches.
        Parameters:
        c - the collection containing the values to match against
        Returns:
        the criteria
      • contains

        public Criteria contains​(java.lang.Object o)
        The contains operator asserts that the provided object is contained in the result. The object that should contain the input can be either an object or a String.
        Parameters:
        o - that should exists in given collection or
        Returns:
        the criteria
      • nin

        public Criteria nin​(java.lang.Object... o)
        The nin operator is similar to $in except that it selects objects for which the specified field does not have any value in the specified array.
        Parameters:
        o - the values to match against
        Returns:
        the criteria
      • nin

        public Criteria nin​(java.util.Collection<?> c)
        The nin operator is similar to $in except that it selects objects for which the specified field does not have any value in the specified array.
        Parameters:
        c - the values to match against
        Returns:
        the criteria
      • all

        public Criteria all​(java.lang.Object... o)
        The all operator is similar to $in, but instead of matching any value in the specified array all values in the array must be matched.
        Parameters:
        o -
        Returns:
        the criteria
      • all

        public Criteria all​(java.util.Collection<?> c)
        The all operator is similar to $in, but instead of matching any value in the specified array all values in the array must be matched.
        Parameters:
        c -
        Returns:
        the criteria
      • size

        public Criteria size​(int size)
        The size operator matches:

        1. array with the specified number of elements.
        2. string with given length.
        Parameters:
        size -
        Returns:
        the criteria
      • type

        public Criteria type​(java.lang.Class<?> clazz)
        The $type operator matches values based on their Java JSON type. Supported types are: List.class Map.class String.class Number.class Boolean.class Other types evaluates to false
        Parameters:
        clazz -
        Returns:
        the criteria
      • exists

        public Criteria exists​(boolean shouldExist)
        Check for existence (or lack thereof) of a field.
        Parameters:
        shouldExist -
        Returns:
        the criteria
      • notEmpty

        @Deprecated
        public Criteria notEmpty()
        Deprecated.
        The notEmpty operator checks that an array or String is not empty.
        Returns:
        the criteria
      • empty

        public Criteria empty​(boolean empty)
        The notEmpty operator checks that an array or String is empty.
        Parameters:
        empty - should be empty
        Returns:
        the criteria
      • matches

        public Criteria matches​(Predicate p)
        The matches operator checks that an object matches the given predicate.
        Parameters:
        p -
        Returns:
        the criteria
      • parse

        @Deprecated
        public static Criteria parse​(java.lang.String criteria)
        Deprecated.
        Parse the provided criteria Deprecated use Filter.parse(String)
        Parameters:
        criteria -
        Returns:
        a criteria
      • create

        @Deprecated
        public static Criteria create​(java.lang.String left,
                                      java.lang.String operator,
                                      java.lang.String right)
        Deprecated.
        Creates a new criteria
        Parameters:
        left - path to evaluate in criteria
        operator - operator
        right - expected value
        Returns:
        a new Criteria
      • prefixPath

        private static java.lang.String prefixPath​(java.lang.String key)
      • checkComplete

        private void checkComplete()