Browse Source

make TYPE filter work on multi-level path

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

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

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

Loading…
Cancel
Save