com.jayway.jsonpath
Class Criteria

java.lang.Object
  extended by com.jayway.jsonpath.Criteria

public class Criteria
extends Object

Author:
Kalle Stenflo

Method Summary
 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.
 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.
 Criteria and(String key)
          Static factory method to create a Criteria using the provided key
 Criteria andOperator(Criteria... criteria)
          Creates an 'and' criteria using the $and operator for all of the provided criteria
 Criteria eq(Object o)
          Creates a criterion using equality
 Criteria exists(boolean b)
          Check for existence (or lack thereof) of a field.
 String getKey()
           
 Criteria gt(Object o)
          Creates a criterion using the > operator
 Criteria gte(Object o)
          Creates a criterion using the >= operator
 Criteria in(Collection<?> c)
          The in operator is analogous to the SQL IN modifier, allowing you to specify an array of possible matches.
 Criteria in(Object... o)
          The in operator is analogous to the SQL IN modifier, allowing you to specify an array of possible matches.
 Criteria is(Object o)
          Creates a criterion using equality
 Criteria lt(Object o)
          Creates a criterion using the < operator
 Criteria lte(Object o)
          Creates a criterion using the <= operator
 boolean matches(Map<String,Object> map)
          Checks if this criteria matches the given map
 Criteria ne(Object o)
          Creates a criterion using the != operator
 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.
 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.
 Criteria regex(Pattern pattern)
          Creates a criterion using a Regex
 Criteria size(int s)
          The size operator matches any array with the specified number of elements.
 Criteria type(Class<?> t)
          The $type operator matches values based on their Java type.
static Criteria where(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, toString, wait, wait, wait
 

Method Detail

getKey

public String getKey()

matches

public boolean matches(Map<String,Object> map)
Checks if this criteria matches the given map

Parameters:
map - map to check
Returns:
true if criteria is a match

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:

eq

public Criteria eq(Object o)
Creates a criterion using equality

Parameters:
o -
Returns:

ne

public Criteria ne(Object o)
Creates a criterion using the != operator

Parameters:
o -
Returns:

lt

public Criteria lt(Object o)
Creates a criterion using the < operator

Parameters:
o -
Returns:

lte

public Criteria lte(Object o)
Creates a criterion using the <= operator

Parameters:
o -
Returns:

gt

public Criteria gt(Object o)
Creates a criterion using the > operator

Parameters:
o -
Returns:

gte

public Criteria gte(Object o)
Creates a criterion using the >= operator

Parameters:
o -
Returns:

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:

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:

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:

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:

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:

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:

size

public Criteria size(int s)
The size operator matches any array with the specified number of elements.

Parameters:
s -
Returns:

exists

public Criteria exists(boolean b)
Check for existence (or lack thereof) of a field.

Parameters:
b -
Returns:

type

public Criteria type(Class<?> t)
The $type operator matches values based on their Java type.

Parameters:
t -
Returns:

regex

public Criteria regex(Pattern pattern)
Creates a criterion using a Regex

Parameters:
pattern -
Returns:

andOperator

public Criteria andOperator(Criteria... criteria)
Creates an 'and' criteria using the $and operator for all of the provided criteria

Parameters:
criteria -


Copyright © 2011-2012. All Rights Reserved.