Java Code Examples for org.codehaus.jackson.JsonNode#isDouble()

The following examples show how to use org.codehaus.jackson.JsonNode#isDouble() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MLOBIOutboundTransport.java    From defense-solutions-proofs-of-concept with Apache License 2.0 6 votes vote down vote up
private String getTrackIdAsString(JsonNode trackIDNode)
{
	String output = null;
	if (trackIDNode.isTextual())
		output = trackIDNode.getTextValue();
	else if (trackIDNode.isInt())
		output = Integer.toString(trackIDNode.getIntValue());
	else if (trackIDNode.isLong())
		output = Long.toString(trackIDNode.getLongValue());
	else if (trackIDNode.isDouble())
		output = Double.toString(trackIDNode.getDoubleValue());
	else if (trackIDNode.isFloatingPointNumber())
		output = trackIDNode.getDecimalValue().toString();

	if (!Validator.isEmpty(output))
	{
		output = output.replace("'", "''");
	}
	return output;
}
 
Example 2
Source File: GeoJsonParser.java    From arcgis-runtime-demo-java with Apache License 2.0 6 votes vote down vote up
private Map<String, Object> parseProperties(JsonNode node) {
  Map<String, Object> properties = new HashMap<String, Object>();
  Iterator<Map.Entry<String, JsonNode>> propertyInterator = node.getFields(); 
  while (propertyInterator.hasNext()) {
    Map.Entry<String, JsonNode> property = propertyInterator.next();
    JsonNode jsonValue = property.getValue();
    if (jsonValue.isInt()) {
      properties.put(property.getKey(), property.getValue().asInt());
    } else if (jsonValue.isDouble()) {
      properties.put(property.getKey(), property.getValue().asDouble());
    } else if (jsonValue.isTextual()) {
      properties.put(property.getKey(), property.getValue().asText());
    }
  }
  return properties;
}