@Override public void onValueNode(ValueNode node, Optional<ContainerNode<?>> parent, List<PathElement> path) { String value = node.isTextual() ? node.textValue() : node.toString(); List<String> placeholders = extractPlaceholderStrings(value); if (!placeholders.isEmpty()) { String pathString = new NodePath(path).toString(); for (String placeholder : placeholders) { unresolvedPlaceholderDescriptions.add(new UnresolvedPlaceholder(pathString, value, placeholder)); } } } }
public void flattenJsonIntoMap(String currentPath, JsonNode jsonNode, Map<String, Object> map) { if (jsonNode.isObject()) { ObjectNode objectNode = (ObjectNode) jsonNode; Iterator<Map.Entry<String, JsonNode>> iter = objectNode.fields(); String pathPrefix = currentPath.isEmpty() ? "" : currentPath + "."; while (iter.hasNext()) { Map.Entry<String, JsonNode> entry = iter.next(); flattenJsonIntoMap(pathPrefix + entry.getKey(), entry.getValue(), map); } } else if (jsonNode.isArray()) { ArrayNode arrayNode = (ArrayNode) jsonNode; for (int i = 0; i < arrayNode.size(); i++) { flattenJsonIntoMap(currentPath + "[" + i + "]", arrayNode.get(i), map); } } else if (jsonNode.isValueNode()) { ValueNode valueNode = (ValueNode) jsonNode; Object value = null; if (valueNode.isNumber()) { value = valueNode.numberValue(); } else if (valueNode.isBoolean()) { value = valueNode.asBoolean(); } else if (valueNode.isTextual()){ value = valueNode.asText(); } map.put(currentPath, value); } } }
@Override public void onValueNode(ValueNode node, Optional<ContainerNode<?>> parent, List<PathElement> path) { String value = node.isTextual() ? node.textValue() : node.toString(); List<Placeholder> placeholders = extractPlaceholders(value); if (!placeholders.isEmpty()) { for (Placeholder placeholder : placeholders) { if (placeholder.hasDefaultValue()) { String valueWithReplacements = replacePlaceholder(value, placeholder.name(), placeholder.defaultValue()); last(path).setChild(parent.get(), TextNode.valueOf(valueWithReplacements)); if (LOGGER.isDebugEnabled()) { LOGGER.debug("At {}, replaced {} with {}", new Object[]{path, value, valueWithReplacements}); } } } } } }
@Override public void onValueNode(ValueNode node, Optional<ContainerNode<?>> parent, List<PathElement> pathAsList) { String path = new NodePath(pathAsList).toString(); String value = node.isTextual() ? node.textValue() : node.toString(); List<Placeholder> placeholders = extractPlaceholders(value); if (placeholders.isEmpty() && !resolved.containsKey(path)) { resolved.put(path, value); passAgain = true; } else { boolean changes = false; for (Placeholder placeholder : placeholders) { String replacement = resolved.get(placeholder.name()); if (replacement != null) { String valueWithReplacements = replacePlaceholder(value, placeholder.name(), replacement); last(pathAsList).setChild(parent.get(), TextNode.valueOf(valueWithReplacements)); if (LOGGER.isDebugEnabled()) { LOGGER.debug("At {}, replaced {} with {}", new Object[]{pathAsList, value, valueWithReplacements}); } value = valueWithReplacements; changes = true; } } passAgain |= changes; } } }
for (JsonNode node : nodes) if (node.isTextual() && filter.getComparisonValue().isTextual())
for (JsonNode node : nodes) if (node.isTextual() && filter.getComparisonValue().isTextual())
field.setValue(valueNode.longValue()); } else if (valueNode.isTextual()) { field.setFieldType(FieldType.STRING); field.setStatus(FieldStatus.SUPPORTED);