Browse Source

make TYPE filter work on multi-level path

pull/16/head
Jochen Berger 12 years ago
parent
commit
4f8da13c17
  1. 9
      json-path/src/main/java/com/jayway/jsonpath/Criteria.java

9
json-path/src/main/java/com/jayway/jsonpath/Criteria.java

@ -243,14 +243,19 @@ public class Criteria {
} else if (CriteriaType.TYPE.equals(key)) {
Class<?> exp = (Class<?>) expectedVal;
Class<?> act = actualVal == null ? null : actualVal.getClass();
final Class<?> exp = (Class<?>) expectedVal;
return objectOrAnyCollectionItemMatches(actualVal, new Predicate<Object>() {
@Override
public boolean accept(Object value) {
Class<?> act = value == null ? null : value.getClass();
if (act == null) {
return false;
} else {
return act.equals(exp);
}
}
});
} else if (CriteriaType.REGEX.equals(key)) {
final Pattern exp = (Pattern) expectedVal;

Loading…
Cancel
Save