/** * Returns a Java object for a json value node based on the node type. */ public static Object valueFromJson(ValueNode node) { if (node instanceof NullNode) { return null; } else { if(node instanceof TextNode) { return node.textValue(); } else if(node instanceof BooleanNode) { return node.booleanValue(); } else if(node instanceof NumericNode) { return node.numberValue(); } else { throw new RuntimeException("Unsupported node type:"+node.getClass().getName()); } } }
/** * Returns a Java object for a json value node based on the node type. */ public static Object valueFromJson(ValueNode node) { if (node instanceof NullNode) { return null; } else { if(node instanceof TextNode) { return node.textValue(); } else if(node instanceof BooleanNode) { return node.booleanValue(); } else if(node instanceof NumericNode) { return node.numberValue(); } else { throw new RuntimeException("Unsupported node type:"+node.getClass().getName()); } } }
@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)); } } } }
@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; } } }
return new JsonPrimitive(vn.asBoolean()); case STRING: return new JsonPrimitive(vn.textValue()); case NULL: return nullValue();
getAttributeDefinition(filter.getAttributePath()); String nodeValue = node.textValue(); String comparisonValue = filter.getComparisonValue().textValue(); if(attributeDefinition == null || !attributeDefinition.isCaseExact())
getAttributeDefinition(filter.getAttributePath()); String nodeValue = node.textValue(); String comparisonValue = filter.getComparisonValue().textValue(); if(attributeDefinition == null || !attributeDefinition.isCaseExact())
field.setFieldType(FieldType.STRING); field.setStatus(FieldStatus.SUPPORTED); field.setValue(valueNode.textValue()); } else if (valueNode.isBoolean()) { field.setFieldType(FieldType.BOOLEAN);