Class Criteria

java.lang.Object
com.jayway.jsonpath.Criteria
All Implemented Interfaces:
Predicate

public class Criteria extends Object implements Predicate
  • Field Details

  • Constructor Details

  • Method Details

    • apply

      public boolean apply(Predicate.PredicateContext ctx)
      Specified by:
      apply in interface Predicate
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toRelationalExpressionNodes

      private Collection<RelationalExpressionNode> toRelationalExpressionNodes()
    • 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(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(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(Object o)
      Creates a criterion using equality
      Parameters:
      o -
      Returns:
      the criteria
    • eq

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

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

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

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

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

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

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

      public Criteria in(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(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(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(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(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(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(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(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(String criteria)
      Deprecated.
      Parse the provided criteria Deprecated use Filter.parse(String)
      Parameters:
      criteria -
      Returns:
      a criteria
    • create

      @Deprecated public static Criteria create(String left, String operator, 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 String prefixPath(String key)
    • checkComplete

      private void checkComplete()