|
|
@ -25,7 +25,7 @@ public class ScanPathToken extends PathToken { |
|
|
|
|
|
|
|
|
|
|
|
//Filters has already been evaluated
|
|
|
|
//Filters has already been evaluated
|
|
|
|
PathToken next = next(); |
|
|
|
PathToken next = next(); |
|
|
|
if (next instanceof FilterPathToken) { |
|
|
|
if (next instanceof PredicatePathToken) { |
|
|
|
if (next.isLeaf()) { |
|
|
|
if (next.isLeaf()) { |
|
|
|
for (Map.Entry<String, Object> match : predicateMatches.entrySet()) { |
|
|
|
for (Map.Entry<String, Object> match : predicateMatches.entrySet()) { |
|
|
|
ctx.addResult(match.getKey(), match.getValue()); |
|
|
|
ctx.addResult(match.getKey(), match.getValue()); |
|
|
@ -60,7 +60,7 @@ public class ScanPathToken extends PathToken { |
|
|
|
for (Object evalModel : models) { |
|
|
|
for (Object evalModel : models) { |
|
|
|
String evalPath = currentPath + "[" + idx + "]"; |
|
|
|
String evalPath = currentPath + "[" + idx + "]"; |
|
|
|
|
|
|
|
|
|
|
|
if (predicate.clazz().equals(FilterPathToken.class)) { |
|
|
|
if (predicate.clazz().equals(PredicatePathToken.class)) { |
|
|
|
if (predicate.matches(evalModel)) { |
|
|
|
if (predicate.matches(evalModel)) { |
|
|
|
predicateMatches.put(evalPath, evalModel); |
|
|
|
predicateMatches.put(evalPath, evalModel); |
|
|
|
} |
|
|
|
} |
|
|
@ -95,7 +95,7 @@ public class ScanPathToken extends PathToken { |
|
|
|
return new ArrayPathTokenPredicate(ctx); |
|
|
|
return new ArrayPathTokenPredicate(ctx); |
|
|
|
} else if (target instanceof WildcardPathToken) { |
|
|
|
} else if (target instanceof WildcardPathToken) { |
|
|
|
return new WildcardPathTokenPredicate(); |
|
|
|
return new WildcardPathTokenPredicate(); |
|
|
|
} else if (target instanceof FilterPathToken) { |
|
|
|
} else if (target instanceof PredicatePathToken) { |
|
|
|
return new FilterPathTokenPredicate(target, ctx); |
|
|
|
return new FilterPathTokenPredicate(target, ctx); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return FALSE_PREDICATE; |
|
|
|
return FALSE_PREDICATE; |
|
|
@ -133,21 +133,21 @@ public class ScanPathToken extends PathToken { |
|
|
|
|
|
|
|
|
|
|
|
private static final class FilterPathTokenPredicate implements Predicate { |
|
|
|
private static final class FilterPathTokenPredicate implements Predicate { |
|
|
|
private final EvaluationContextImpl ctx; |
|
|
|
private final EvaluationContextImpl ctx; |
|
|
|
private FilterPathToken filterPathToken; |
|
|
|
private PredicatePathToken predicatePathToken; |
|
|
|
|
|
|
|
|
|
|
|
private FilterPathTokenPredicate(PathToken target, EvaluationContextImpl ctx) { |
|
|
|
private FilterPathTokenPredicate(PathToken target, EvaluationContextImpl ctx) { |
|
|
|
this.ctx = ctx; |
|
|
|
this.ctx = ctx; |
|
|
|
filterPathToken = (FilterPathToken) target; |
|
|
|
predicatePathToken = (PredicatePathToken) target; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Class<?> clazz() { |
|
|
|
public Class<?> clazz() { |
|
|
|
return FilterPathToken.class; |
|
|
|
return PredicatePathToken.class; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean matches(Object model) { |
|
|
|
public boolean matches(Object model) { |
|
|
|
return filterPathToken.accept(model, ctx.configuration()); |
|
|
|
return predicatePathToken.accept(model, ctx.configuration()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|