/** * 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 value(float value) { if (Float.isInfinite(value) || Float.isNaN(value)) { throw new IllegalArgumentException("Infinite and NaN values not permitted in JSON"); } return new JsonNumber(cutOffPointZero(Float.toString(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 value(double value) { if (Double.isInfinite(value) || Double.isNaN(value)) { throw new IllegalArgumentException("Infinite and NaN values not permitted in JSON"); } return new JsonNumber(cutOffPointZero(Double.toString(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 value(double value) { if (Double.isInfinite(value) || Double.isNaN(value)) { throw new IllegalArgumentException("Infinite and NaN values not permitted in JSON"); } return new JsonNumber(cutOffPointZero(Double.toString(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 value(float value) { if (Float.isInfinite(value) || Float.isNaN(value)) { throw new IllegalArgumentException("Infinite and NaN values not permitted in JSON"); } return new JsonNumber(cutOffPointZero(Float.toString(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 value(double value) { if (Double.isInfinite(value) || Double.isNaN(value)) { throw new IllegalArgumentException("Infinite and NaN values not permitted in JSON"); } return new JsonNumber(cutOffPointZero(Double.toString(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 value(float value) { if (Float.isInfinite(value) || Float.isNaN(value)) { throw new IllegalArgumentException("Infinite and NaN values not permitted in JSON"); } return new JsonNumber(cutOffPointZero(Float.toString(value))); }