public static PathToken createWildCardPathToken() { return new WildcardPathToken(); }
@Override public void evaluate(String currentPath, PathRef parent, Object model, EvaluationContextImpl ctx) { if (ctx.jsonProvider().isMap(model)) { for (String property : ctx.jsonProvider().getPropertyKeys(model)) { handleObjectProperty(currentPath, model, ctx, Collections.singletonList(property)); } } else if (ctx.jsonProvider().isArray(model)) { for (int idx = 0; idx < ctx.jsonProvider().length(model); idx++) { try { handleArrayIndex(idx, currentPath, model, ctx); } catch (PathNotFoundException p){ if(ctx.options().contains(Option.REQUIRE_PROPERTIES)){ throw p; } } } } }
@Override public void evaluate(String currentPath, PathRef parent, Object model, EvaluationContextImpl ctx) { if (ctx.jsonProvider().isMap(model)) { for (String property : ctx.jsonProvider().getPropertyKeys(model)) { handleObjectProperty(currentPath, model, ctx, asList(property)); } } else if (ctx.jsonProvider().isArray(model)) { for (int idx = 0; idx < ctx.jsonProvider().length(model); idx++) { try { handleArrayIndex(idx, currentPath, model, ctx); } catch (PathNotFoundException p){ if(ctx.options().contains(Option.REQUIRE_PROPERTIES)){ throw p; } } } } }
@Test public void is_upstream_definite_in_complex_case() { assertThat(makePathReturningTail(makePPT("foo"), makePPT("bar"), makePPT("baz")).isUpstreamDefinite()).isTrue(); assertThat(makePathReturningTail(makePPT("foo"), new WildcardPathToken()).isUpstreamDefinite()).isTrue(); assertThat(makePathReturningTail(new WildcardPathToken(), makePPT("bar"), makePPT("baz")).isUpstreamDefinite()).isFalse(); }
@Override public void evaluate(String currentPath, PathRef parent, Object model, EvaluationContextImpl ctx) { if (ctx.jsonProvider().isMap(model)) { for (String property : ctx.jsonProvider().getPropertyKeys(model)) { handleObjectProperty(currentPath, model, ctx, asList(property)); } } else if (ctx.jsonProvider().isArray(model)) { /* * Assert.assertNotNull(ctx.getCurrentProperty()); ctx.configuration().jsonProvider().setProperty(curr, ctx.getCurrentProperty(), arrObj); * ctx.setLineageParent(arrObj); */ for (int idx = 0; idx < ctx.jsonProvider().length(model); idx++) { try { handleArrayIndex(idx, currentPath, model, ctx); } catch (PathNotFoundException p){ if(ctx.options().contains(Option.REQUIRE_PROPERTIES)){ throw p; } } } } }
@Test public void is_upstream_definite_in_simple_case() { assertThat(makePathReturningTail(makePPT("foo")).isUpstreamDefinite()).isTrue(); assertThat(makePathReturningTail(makePPT("foo"), makePPT("bar")).isUpstreamDefinite()).isTrue(); assertThat(makePathReturningTail(makePPT("foo", "foo2"), makePPT("bar")).isUpstreamDefinite()).isFalse(); assertThat(makePathReturningTail(new WildcardPathToken(), makePPT("bar")).isUpstreamDefinite()).isFalse(); assertThat(makePathReturningTail(new ScanPathToken(), makePPT("bar")).isUpstreamDefinite()).isFalse(); }
public static PathToken createWildCardPathToken() { return new WildcardPathToken(); }
public static PathToken createWildCardPathToken() { return new WildcardPathToken(); }