/** * Returns a JsonValue instance that represents the given <code>long</code> value. * * @param value the value to get a JSON representation for * @return a JSON value that represents the given value */ public static JsonValue valueOf(long value) { return new JsonNumber(value); }
/** * Returns a JsonValue instance that represents the given <code>long</code> value. * * @param value the value to get a JSON representation for * @return a JSON value that represents the given value */ public static JsonValue valueOf(long value) { return new JsonNumber(value); }
/** * Returns a JsonValue instance that represents the given <code>int</code> value. * * @param value the value to get a JSON representation for * @return a JSON value that represents the given value */ public static JsonValue valueOf(int value) { return new JsonNumber(value); }
/** * Returns a JsonValue instance that represents the given <code>double</code> value. * * @param value the value to get a JSON representation for * @return a JSON value that represents the given value */ public static JsonValue valueOf(double value) { return new JsonNumber(value); }
/** * Returns a JsonValue instance that represents the given <code>float</code> value. * * @param value the value to get a JSON representation for * @return a JSON value that represents the given value */ public static JsonValue valueOf(float value) { return new JsonNumber(value); }
/** * Returns a JsonValue instance that represents the given <code>float</code> value. * * @param value the value to get a JSON representation for * @return a JSON value that represents the given value */ public static JsonValue valueOf(float value) { return new JsonNumber(value); }
/** * Returns a JsonValue instance that represents the given <code>double</code> value. * * @param value the value to get a JSON representation for * @return a JSON value that represents the given value */ public static JsonValue valueOf(double value) { return new JsonNumber(value); }
/** * Returns a JsonValue instance that represents the given <code>int</code> value. * * @param value the value to get a JSON representation for * @return a JSON value that represents the given value */ public static JsonValue valueOf(int value) { return new JsonNumber(value); }
public JsonValue parse(String text) { switch (text) { case "+inf": case "inf": case "+Inf": case "Inf": return new JsonNumber(Double.POSITIVE_INFINITY); case "-inf": case "-Inf": return new JsonNumber(Double.NEGATIVE_INFINITY); case "nan": case "NaN": return new JsonNumber(Double.NaN); default: return null; } }
public JsonValue parse(String text) { switch (text) { case "+inf": case "inf": case "+Inf": case "Inf": return new JsonNumber(Double.POSITIVE_INFINITY); case "-inf": case "-Inf": return new JsonNumber(Double.NEGATIVE_INFINITY); case "nan": case "NaN": return new JsonNumber(Double.NaN); default: return null; } }
public JsonValue parse(String text) { if (isHex.matcher(text).find()) return new JsonNumber(Long.parseLong(text.substring(2), 16)); else return null; }
public JsonValue parse(String text) { if (isHex.matcher(text).find()) return new JsonNumber(Long.parseLong(text.substring(2), 16)); else return null; }
return new JsonNumber(Double.parseDouble(value.substring(0, last)));
return new JsonNumber(Double.parseDouble(value.substring(0, last)));
private JsonValue readNumber() throws IOException { startCapture(); readIf('-'); int firstDigit=current; if (!readDigit()) { throw expected("digit"); } if (firstDigit!='0') { while (readDigit()) { } } readFraction(); readExponent(); return new JsonNumber(Double.parseDouble(endCapture())); }
private JsonValue readNumber() throws IOException { startCapture(); readIf('-'); int firstDigit=current; if (!readDigit()) { throw expected("digit"); } if (firstDigit!='0') { while (readDigit()) { } } readFraction(); readExponent(); return new JsonNumber(Double.parseDouble(endCapture())); }