public int getTokenCount() { int cnt = 1; PathToken token = this; while (!token.isLeaf()){ token = token.next(); cnt++; } return cnt; }
@Override public String toString() { if (isLeaf()) { return getPathFragment(); } else { return getPathFragment() + next().toString(); } }
protected void handleArrayIndex(int index, String currentPath, Object model, EvaluationContextImpl ctx) { String evalPath = Utils.concat(currentPath, "[", String.valueOf(index), "]"); PathRef pathRef = ctx.forUpdate() ? PathRef.create(model, index) : PathRef.NO_OP; int effectiveIndex = index < 0 ? ctx.jsonProvider().length(model) + index : index; try { Object evalHit = ctx.jsonProvider().getArrayIndex(model, effectiveIndex); if (isLeaf()) { ctx.addResult(evalPath, pathRef, evalHit); } else { next().evaluate(evalPath, pathRef, evalHit, ctx); } } catch (IndexOutOfBoundsException e) { } }
next().evaluate(evalPath, pathRef, propertyVal, ctx);
public static void walkArray(PathToken pt, String currentPath, PathRef parent, Object model, EvaluationContextImpl ctx, Predicate predicate) { if (predicate.matches(model)) { if (pt.isLeaf()) { pt.evaluate(currentPath, parent, model, ctx); } else { PathToken next = pt.next(); Iterable<?> models = ctx.jsonProvider().toIterable(model); int idx = 0; for (Object evalModel : models) { String evalPath = currentPath + "[" + idx + "]"; next.evaluate(evalPath, parent, evalModel, ctx); idx++; } } } Iterable<?> models = ctx.jsonProvider().toIterable(model); int idx = 0; for (Object evalModel : models) { String evalPath = currentPath + "[" + idx + "]"; walk(pt, evalPath, PathRef.create(model, idx), evalModel, ctx, predicate); idx++; } }
PathToken token = path; PathToken prior = null; while (null != (token = token.next()) && !(token instanceof FunctionPathToken)) { prior = token;
public int getTokenCount() { int cnt = 1; PathToken token = this; while (!token.isLeaf()){ token = token.next(); cnt++; } return cnt; }
@Override public String toString() { if (isLeaf()) { return getPathFragment(); } else { return getPathFragment() + next().toString(); } }
protected void handleArrayIndex(int index, String currentPath, Object model, EvaluationContextImpl ctx) { String evalPath = Utils.concat(currentPath, "[", String.valueOf(index), "]"); PathRef pathRef = ctx.forUpdate() ? PathRef.create(model, index) : PathRef.NO_OP; int effectiveIndex = index < 0 ? ctx.jsonProvider().length(model) + index : index; try { Object evalHit = ctx.jsonProvider().getArrayIndex(model, effectiveIndex); if (isLeaf()) { ctx.addResult(evalPath, pathRef, evalHit); } else { next().evaluate(evalPath, pathRef, evalHit, ctx); } } catch (IndexOutOfBoundsException e) { } }
next().evaluate(evalPath, pathRef, propertyVal, ctx);
public static void walkArray(PathToken pt, String currentPath, PathRef parent, Object model, EvaluationContextImpl ctx, Predicate predicate) { if (predicate.matches(model)) { if (pt.isLeaf()) { pt.evaluate(currentPath, parent, model, ctx); } else { PathToken next = pt.next(); Iterable<?> models = ctx.jsonProvider().toIterable(model); int idx = 0; for (Object evalModel : models) { String evalPath = currentPath + "[" + idx + "]"; next.evaluate(evalPath, parent, evalModel, ctx); idx++; } } } Iterable<?> models = ctx.jsonProvider().toIterable(model); int idx = 0; for (Object evalModel : models) { String evalPath = currentPath + "[" + idx + "]"; walk(pt, evalPath, PathRef.create(model, idx), evalModel, ctx, predicate); idx++; } }
public int getTokenCount() { int cnt = 1; PathToken token = this; while (!token.isLeaf()){ token = token.next(); cnt++; } return cnt; }
@Override public String toString() { if (isLeaf()) { return getPathFragment(); } else { return getPathFragment() + next().toString(); } }
PathToken token = path; PathToken prior = null; while (null != (token = token.next()) && !(token instanceof FunctionPathToken)) { prior = token;
public static void walkArray(PathToken pt, String currentPath, PathRef parent, Object model, EvaluationContextImpl ctx, Predicate predicate) { if (predicate.matches(model)) { if (pt.isLeaf()) { pt.evaluate(currentPath, parent, model, ctx); } else { PathToken next = pt.next(); Iterable<?> models = ctx.jsonProvider().toIterable(model); int idx = 0; for (Object evalModel : models) { String evalPath = currentPath + "[" + idx + "]"; next.evaluate(evalPath, parent, evalModel, ctx); idx++; } } } Iterable<?> models = ctx.jsonProvider().toIterable(model); int idx = 0; for (Object evalModel : models) { String evalPath = currentPath + "[" + idx + "]"; walk(pt, evalPath, PathRef.create(model, idx), evalModel, ctx, predicate); idx++; } }
next().evaluate(evalPath, pathRef, propertyVal, ctx);
next().evaluate(evalPath, pathRef, evalHit, ctx);