/** Finds the child with the specified index and returns it as a double. * @throws IllegalArgumentException if the child was not found. */ public double getDouble (int index) { JsonValue child = get(index); if (child == null) throw new IllegalArgumentException("Indexed value not found: " + name); return child.asDouble(); }
/** Finds the child with the specified name and returns it as a double. * @throws IllegalArgumentException if the child was not found. */ public double getDouble (String name) { JsonValue child = get(name); if (child == null) throw new IllegalArgumentException("Named value not found: " + name); return child.asDouble(); }
/** Finds the child with the specified index and returns it as a double. * @throws IllegalArgumentException if the child was not found. */ public double getDouble (int index) { JsonValue child = get(index); if (child == null) throw new IllegalArgumentException("Indexed value not found: " + name); return child.asDouble(); }
/** Finds the child with the specified name and returns it as a double. * @throws IllegalArgumentException if the child was not found. */ public double getDouble (String name) { JsonValue child = get(name); if (child == null) throw new IllegalArgumentException("Named value not found: " + name); return child.asDouble(); }
/** Finds the child with the specified name and returns it as a double. Returns defaultValue if not found. */ public double getDouble (String name, double defaultValue) { JsonValue child = get(name); return (child == null || !child.isValue() || child.isNull()) ? defaultValue : child.asDouble(); }
/** Finds the child with the specified name and returns it as a double. Returns defaultValue if not found. */ public double getDouble (String name, double defaultValue) { JsonValue child = get(name); return (child == null || !child.isValue() || child.isNull()) ? defaultValue : child.asDouble(); }
writer.append(outputType.quoteValue(object.asString())); } else if (object.isDouble()) { double doubleValue = object.asDouble(); long longValue = object.asLong(); writer.append(Double.toString(doubleValue == longValue ? longValue : doubleValue));
writer.append(outputType.quoteValue(object.asString())); } else if (object.isDouble()) { double doubleValue = object.asDouble(); long longValue = object.asLong(); writer.append(Double.toString(doubleValue == longValue ? longValue : doubleValue));
if (type == int.class || type == Integer.class) return (T)(Integer)jsonData.asInt(); if (type == long.class || type == Long.class) return (T)(Long)jsonData.asLong(); if (type == double.class || type == Double.class) return (T)(Double)jsonData.asDouble(); if (type == String.class) return (T)jsonData.asString(); if (type == short.class || type == Short.class) return (T)(Short)jsonData.asShort();
if (type == int.class || type == Integer.class) return (T)(Integer)jsonData.asInt(); if (type == long.class || type == Long.class) return (T)(Long)jsonData.asLong(); if (type == double.class || type == Double.class) return (T)(Double)jsonData.asDouble(); if (type == String.class) return (T)jsonData.asString(); if (type == short.class || type == Short.class) return (T)(Short)jsonData.asShort();
} else if (value.isDouble()) { if (value.name != null) name(value.name); value(value.asDouble()); } else if (value.isLong()) { if (value.name != null) name(value.name);
} else if (value.isDouble()) { if (value.name != null) name(value.name); value(value.asDouble()); } else if (value.isLong()) { if (value.name != null) name(value.name);
buffer.append(outputType.quoteValue(object.asString())); } else if (object.isDouble()) { double doubleValue = object.asDouble(); long longValue = object.asLong(); buffer.append(doubleValue == longValue ? longValue : doubleValue);
buffer.append(outputType.quoteValue(object.asString())); } else if (object.isDouble()) { double doubleValue = object.asDouble(); long longValue = object.asLong(); buffer.append(doubleValue == longValue ? longValue : doubleValue);
buffer.append(outputType.quoteValue(object.asString())); } else if (object.isDouble()) { double doubleValue = object.asDouble(); long longValue = object.asLong(); buffer.append(doubleValue == longValue ? longValue : doubleValue);
buffer.append(outputType.quoteValue(object.asString())); } else if (object.isDouble()) { double doubleValue = object.asDouble(); long longValue = object.asLong(); buffer.append(doubleValue == longValue ? longValue : doubleValue);
/** Finds the child with the specified name and returns it as a double. * @throws IllegalArgumentException if the child was not found. */ public double getDouble (String name) { JsonValue child = get(name); if (child == null) throw new IllegalArgumentException("Named value not found: " + name); return child.asDouble(); }
/** Finds the child with the specified index and returns it as a double. * @throws IllegalArgumentException if the child was not found. */ public double getDouble (int index) { JsonValue child = get(index); if (child == null) throw new IllegalArgumentException("Indexed value not found: " + name); return child.asDouble(); }
/** Finds the child with the specified name and returns it as a double. Returns defaultValue if not found. */ public double getDouble (String name, double defaultValue) { JsonValue child = get(name); return (child == null || !child.isValue() || child.isNull()) ? defaultValue : child.asDouble(); }
private Object getValue(JsonValue val) { Object value = null; switch (val.type()) { case stringValue: value = val.asString(); break; case doubleValue: value = val.asDouble(); break; case booleanValue: value = val.asBoolean(); break; case longValue: value = val.asLong(); break; default: break; } return value; }