Package com.jayway.jsonpath
Class Criteria
java.lang.Object
com.jayway.jsonpath.Criteria
- All Implemented Interfaces:
Predicate
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jayway.jsonpath.Predicate
Predicate.PredicateContext -
Method Summary
Modifier and TypeMethodDescriptionThealloperator is similar to $in, but instead of matching any value in the specified array all values in the array must be matched.all(Collection<?> c) Thealloperator is similar to $in, but instead of matching any value in the specified array all values in the array must be matched.Static factory method to create a Criteria using the provided keyTheanyofoperator selects objects for which the specified field is an array that contain at least an element in the specified array.anyof(Collection<?> c) Theanyofoperator selects objects for which the specified field is an array that contain at least an element in the specified array.booleanThecontainsoperator asserts that the provided object is contained in the result.static CriteriaDeprecated.empty(boolean empty) ThenotEmptyoperator checks that an array or String is empty.Creates a criterion using equalityexists(boolean shouldExist) Check for existence (or lack thereof) of a field.Creates a criterion using the > operatorCreates a criterion using the >= operatorTheinoperator is analogous to the SQL IN modifier, allowing you to specify an array of possible matches.in(Collection<?> c) Theinoperator is analogous to the SQL IN modifier, allowing you to specify an array of possible matches.Creates a criterion using equalityCreates a criterion using the < operatorCreates a criterion using the <= operatorThematchesoperator checks that an object matches the given predicate.Creates a criterion using the != operatorTheninoperator is similar to $in except that it selects objects for which the specified field does not have any value in the specified array.nin(Collection<?> c) Theninoperator is similar to $in except that it selects objects for which the specified field does not have any value in the specified array.Thenoneofoperator selects objects for which the specified field is an array that does not contain any of the elements of the specified array.noneof(Collection<?> c) Thenoneofoperator selects objects for which the specified field is an array that does not contain any of the elements of the specified array.notEmpty()Deprecated.static CriteriaDeprecated.Creates a criterion using a Regexsize(int size) Thesizeoperator matches:Thesubsetofoperator selects objects for which the specified field is an array whose elements comprise a subset of the set comprised by the elements of the specified array.subsetof(Collection<?> c) Thesubsetofoperator selects objects for which the specified field is an array whose elements comprise a subset of the set comprised by the elements of the specified array.toString()The $type operator matches values based on their Java JSON type.static CriteriaDeprecated.static CriteriaStatic factory method to create a Criteria using the provided key
-
Method Details
-
apply
-
toString
-
where
Deprecated.Static factory method to create a Criteria using the provided key- Parameters:
key- filed name- Returns:
- the new criteria
-
where
Static factory method to create a Criteria using the provided key- Parameters:
key- filed name- Returns:
- the new criteria
-
and
Static factory method to create a Criteria using the provided key- Parameters:
key- ads new filed to criteria- Returns:
- the criteria builder
-
is
Creates a criterion using equality- Parameters:
o-- Returns:
- the criteria
-
eq
Creates a criterion using equality- Parameters:
o-- Returns:
- the criteria
-
ne
Creates a criterion using the != operator- Parameters:
o-- Returns:
- the criteria
-
lt
Creates a criterion using the < operator- Parameters:
o-- Returns:
- the criteria
-
lte
Creates a criterion using the <= operator- Parameters:
o-- Returns:
- the criteria
-
gt
Creates a criterion using the > operator- Parameters:
o-- Returns:
- the criteria
-
gte
Creates a criterion using the >= operator- Parameters:
o-- Returns:
- the criteria
-
regex
Creates a criterion using a Regex- Parameters:
pattern-- Returns:
- the criteria
-
in
Theinoperator 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
Theinoperator 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
Thecontainsoperator 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
Theninoperator 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
Theninoperator 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
-
subsetof
Thesubsetofoperator selects objects for which the specified field is an array whose elements comprise a subset of the set comprised by the elements of the specified array.- Parameters:
o- the values to match against- Returns:
- the criteria
-
subsetof
Thesubsetofoperator selects objects for which the specified field is an array whose elements comprise a subset of the set comprised by the elements of the specified array.- Parameters:
c- the values to match against- Returns:
- the criteria
-
anyof
Theanyofoperator selects objects for which the specified field is an array that contain at least an element in the specified array.- Parameters:
o- the values to match against- Returns:
- the criteria
-
anyof
Theanyofoperator selects objects for which the specified field is an array that contain at least an element in the specified array.- Parameters:
c- the values to match against- Returns:
- the criteria
-
noneof
Thenoneofoperator selects objects for which the specified field is an array that does not contain any of the elements of the specified array.- Parameters:
o- the values to match against- Returns:
- the criteria
-
noneof
Thenoneofoperator selects objects for which the specified field is an array that does not contain any of the elements of the specified array.- Parameters:
c- the values to match against- Returns:
- the criteria
-
all
Thealloperator 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
Thealloperator 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
Thesizeoperator matches:- array with the specified number of elements.
- string with given length.
- Parameters:
size-- Returns:
- the criteria
-
type
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
Check for existence (or lack thereof) of a field.- Parameters:
shouldExist-- Returns:
- the criteria
-
notEmpty
Deprecated.ThenotEmptyoperator checks that an array or String is not empty.- Returns:
- the criteria
-
empty
ThenotEmptyoperator checks that an array or String is empty.- Parameters:
empty- should be empty- Returns:
- the criteria
-
matches
Thematchesoperator checks that an object matches the given predicate.- Parameters:
p-- Returns:
- the criteria
-
parse
Deprecated.Parse the provided criteria Deprecated useFilter.parse(String)- Parameters:
criteria-- Returns:
- a criteria
-
create
Deprecated.Creates a new criteria- Parameters:
left- path to evaluate in criteriaoperator- operatorright- expected value- Returns:
- a new Criteria
-