/** * Alias of {@link #path(int)}. * * @deprecated Use {@link #path(int)} instead */ @Deprecated public final JsonNode getPath(int index) { return path(index); }
/** * Alias of {@link #path(String)}. * * @deprecated Use {@link #path(String)} instead */ @Deprecated public final JsonNode getPath(String fieldName) { return path(fieldName); }
/** * Alias of {@link #path(String)}. * * @deprecated Use {@link #path(String)} instead */ @Deprecated public final JsonNode getPath(String fieldName) { return path(fieldName); }
/** * Alias of {@link #path(int)}. * * @deprecated Use {@link #path(int)} instead */ @Deprecated public final JsonNode getPath(int index) { return path(index); }
/** * Alias of {@link #path(String)}. * * @deprecated Use {@link #path(String)} instead */ @Deprecated public final JsonNode getPath(String fieldName) { return path(fieldName); }
/** * Alias of {@link #path(int)}. * * @deprecated Use {@link #path(int)} instead */ @Deprecated public final JsonNode getPath(int index) { return path(index); }
private Iterator<JsonNode> dataElements(InputStream dataStream) throws IOException, JsonParseException, JsonMappingException { JsonNode rootNode = OBJECT_MAPPER.readValue(dataStream, JsonNode.class); JsonNode dataNode = rootNode.path(DATA_TOKEN); Iterator<JsonNode> elements = dataNode.getElements(); return elements; }
private Iterator<JsonNode> dataElements(InputStream dataStream) throws IOException, JsonParseException, JsonMappingException { JsonNode rootNode = OBJECT_MAPPER.readValue(dataStream, JsonNode.class); JsonNode dataNode = rootNode.path(KeyValueTokens.DATA_TOKEN); Iterator<JsonNode> elements = dataNode.getElements(); return elements; }
private JsonNode valueNode(JsonNode element) { if (element.has(KeyValueTokens.VALUE_TOKEN)) { return element.path(KeyValueTokens.VALUE_TOKEN); } else { throw new IllegalArgumentException("Given dataset does not contain "+KeyValueTokens.VALUE_TOKEN+" token."); } }
public boolean hasNode(String key) { JsonNode result = node.path(key); return result.isMissingNode() == false; }
private Iterator<JsonNode> dataElements(InputStream dataStream) throws IOException, JsonParseException, JsonMappingException { JsonNode rootNode = OBJECT_MAPPER.readValue(dataStream, JsonNode.class); JsonNode dataNode = rootNode.path(KeyValueTokens.DATA_TOKEN); Iterator<JsonNode> elements = dataNode.getElements(); return elements; }
private Iterator<JsonNode> dataElements(InputStream dataStream) throws IOException, JsonParseException, JsonMappingException { JsonNode rootNode = OBJECT_MAPPER.readValue(dataStream, JsonNode.class); JsonNode dataNode = rootNode.path(DATA_TOKEN); Iterator<JsonNode> elements = dataNode.getElements(); return elements; }
public ReadOnlyJsonNode path(final String fieldName) { return wrap(delegate.path(fieldName)); }
private String implementationKeyClass(JsonNode element) { String implementationValue = NO_IMPLEMENTATION_PROVIDED; if (element.has(KeyValueTokens.IMPLEMENTATION_KEY_TOKEN)) { implementationValue = element.path(KeyValueTokens.IMPLEMENTATION_KEY_TOKEN).getTextValue(); } return implementationValue.trim(); }
private String implementationClass(JsonNode element) { String implementationValue = NO_IMPLEMENTATION_PROVIDED; if (element.has(KeyValueTokens.IMPLEMENTATION_TOKEN)) { implementationValue = element.path(KeyValueTokens.IMPLEMENTATION_TOKEN).getTextValue(); } return implementationValue.trim(); }
/** {@inheritDoc} */ @Override public FijiRowFilter createFromJson(JsonNode rootNode) { float chance = (float) rootNode.path(CHANCE_NODE).getValueAsDouble(); return new FijiRandomRowFilter(chance); } }
private Object keyValue(JsonNode element) throws JsonParseException, JsonMappingException, IOException, ClassNotFoundException { Object keyValue; if (element.has(KeyValueTokens.KEY_TOKEN)) { String implementationKey = implementationKeyClass(element); keyValue = readElement(element.path(KeyValueTokens.KEY_TOKEN), implementationKey); } else { throw new IllegalArgumentException("Given dataset does not contain "+KeyValueTokens.KEY_TOKEN+" token."); } return keyValue; }
private Object keyValue(JsonNode element) throws JsonParseException, JsonMappingException, IOException, ClassNotFoundException { Object keyValue; if (element.has(KeyValueTokens.KEY_TOKEN)) { String implementationKey = implementationKeyClass(element); keyValue = readElement(element.path(KeyValueTokens.KEY_TOKEN), implementationKey); } else { throw new IllegalArgumentException("Given dataset does not contain "+KeyValueTokens.KEY_TOKEN+" token."); } return keyValue; }
@Override Float parse() throws ParseException { final JsonNode value = node.path(BOOST_PROPERTY); if (value.isFloatingPointNumber()) { return (float) value.asDouble(); } throw new ParseException("Invalid property '" + BOOST_PROPERTY + "': value is not a float"); }
private void convertLatitude(final JsonNode obj) { final ObjectNode node = (ObjectNode) obj.path("ChargeDeviceLocation"); final JsonNode current = node.path("Latitude"); if (!current.isMissingNode() && !current.isNull()) { final double value = Double.parseDouble(current.asText()); node.put("Latitude", value); } if (current.isNull()) { node.remove("Latitude"); } }