Java Code Examples for org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode#asDouble()

The following examples show how to use org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode#asDouble() . 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: CsvRowDataDeserializationSchema.java    From flink with Apache License 2.0 5 votes vote down vote up
private double convertToDouble(JsonNode jsonNode) {
	if (jsonNode.isDouble()) {
		// avoid redundant toString and parseDouble, for better performance
		return jsonNode.asDouble();
	} else {
		return Double.parseDouble(jsonNode.asText().trim());
	}
}
 
Example 2
Source File: CsvRowDataDeserializationSchema.java    From flink with Apache License 2.0 5 votes vote down vote up
private float convertToFloat(JsonNode jsonNode) {
	if (jsonNode.isDouble()) {
		// avoid redundant toString and parseDouble, for better performance
		return (float) jsonNode.asDouble();
	} else {
		return Float.parseFloat(jsonNode.asText().trim());
	}
}
 
Example 3
Source File: JsonRowDeserializationSchema.java    From flink with Apache License 2.0 5 votes vote down vote up
private double convertToDouble(ObjectMapper mapper, JsonNode jsonNode) {
	if (jsonNode.isDouble()) {
		// avoid redundant toString and parseDouble, for better performance
		return jsonNode.asDouble();
	} else {
		return Double.parseDouble(jsonNode.asText().trim());
	}
}
 
Example 4
Source File: JsonRowDataDeserializationSchema.java    From flink with Apache License 2.0 5 votes vote down vote up
private double convertToDouble(JsonNode jsonNode) {
	if (jsonNode.isDouble()) {
		// avoid redundant toString and parseDouble, for better performance
		return jsonNode.asDouble();
	} else {
		return Double.parseDouble(jsonNode.asText().trim());
	}
}
 
Example 5
Source File: JsonRowDataDeserializationSchema.java    From flink with Apache License 2.0 5 votes vote down vote up
private float convertToFloat(JsonNode jsonNode) {
	if (jsonNode.isDouble()) {
		// avoid redundant toString and parseDouble, for better performance
		return (float) jsonNode.asDouble();
	} else {
		return Float.parseFloat(jsonNode.asText().trim());
	}
}