@Test public void testSlash() throws Exception { JsonPointer pointer = new JsonPointer("/a~1b"); String expected = "a/b"; String actual = sut.apply(pointer); assertThat(actual, is(expected)); }
@Override public String apply(JsonPointer pointer) { log.trace("pointer = {}", pointer); List<String> elements = new ArrayList<>(); for (TokenResolver<JsonNode> tokenResolver : pointer) { String token = tokenResolver.getToken().getRaw(); log.trace("tokenResolver = {}", token); if (ARRAY_PATTERN.matcher(token).matches()) { String last = elements.get(elements.size() - 1); elements.set(elements.size() - 1, String.format(Locale.ENGLISH, "%s[%s]", last, token)); } else { elements.add(token); } } return elements.stream().collect(Collectors.joining(".")); }
JsonPathToAttributePath implements Function<JsonPointer, String> { @Override public String apply(JsonPointer pointer) { log.trace("pointer = {}", pointer); List<String> elements = new ArrayList<>(); for (TokenResolver<JsonNode> tokenResolver : pointer) { String token = tokenResolver.getToken().getRaw(); log.trace("tokenResolver = {}", token); if (ARRAY_PATTERN.matcher(token).matches()) { String last = elements.get(elements.size() - 1); elements.set(elements.size() - 1, String.format(Locale.ENGLISH, "%s[%s]", last, token)); } else { elements.add(token); } } return elements.stream().collect(Collectors.joining(".")); } }
JsonPathToAttributePath implements Function<JsonPointer, String> { @Override public String apply(JsonPointer pointer) { log.trace("pointer = {}", pointer); List<String> elements = new ArrayList<>(); for (TokenResolver<JsonNode> tokenResolver : pointer) { String token = tokenResolver.getToken().getRaw(); log.trace("tokenResolver = {}", token); if (ARRAY_PATTERN.matcher(token).matches()) { String last = elements.get(elements.size() - 1); elements.set(elements.size() - 1, String.format(Locale.ENGLISH, "%s[%s]", last, token)); } else { elements.add(token); } } return elements.stream().collect(Collectors.joining(".")); }  }
JsonPathToAttributePath implements Function<JsonPointer, String> { @Override public String apply(JsonPointer pointer) { log.trace("pointer = {}", pointer); List<String> elements = new ArrayList<>(); for (TokenResolver<JsonNode> tokenResolver : pointer) { String token = tokenResolver.getToken().getRaw(); log.trace("tokenResolver = {}", token); if (ARRAY_PATTERN.matcher(token).matches()) { String last = elements.get(elements.size() - 1); elements.set(elements.size() - 1, String.format(Locale.ENGLISH, "%s[%s]", last, token)); } else { elements.add(token); } } return elements.stream().collect(Collectors.joining(".")); }  @Override String apply(JsonPointer pointer); }
JsonPathToAttributePath implements Function<JsonPointer, String> { @Override public String apply(JsonPointer pointer) { log.trace("pointer = {}", pointer); List<String> elements = new ArrayList<>(); for (TokenResolver<JsonNode> tokenResolver : pointer) { String token = tokenResolver.getToken().getRaw(); log.trace("tokenResolver = {}", token); if (ARRAY_PATTERN.matcher(token).matches()) { String last = elements.get(elements.size() - 1); elements.set(elements.size() - 1, String.format(Locale.ENGLISH, "%s[%s]", last, token)); } else { elements.add(token); } } return elements.stream().collect(Collectors.joining(".")); }  @Override String apply(JsonPointer pointer);  }