/** Finds the child with the specified name and returns it as a long. * @throws IllegalArgumentException if the child was not found. */ public long getLong (String name) { JsonValue child = get(name); if (child == null) throw new IllegalArgumentException("Named value not found: " + name); return child.asLong(); }
/** Finds the child with the specified name and returns it as a long. * @throws IllegalArgumentException if the child was not found. */ public long getLong (String name) { JsonValue child = get(name); if (child == null) throw new IllegalArgumentException("Named value not found: " + name); return child.asLong(); }
/** Finds the child with the specified index and returns it as a long. * @throws IllegalArgumentException if the child was not found. */ public long getLong (int index) { JsonValue child = get(index); if (child == null) throw new IllegalArgumentException("Indexed value not found: " + name); return child.asLong(); }
/** Finds the child with the specified index and returns it as a long. * @throws IllegalArgumentException if the child was not found. */ public long getLong (int index) { JsonValue child = get(index); if (child == null) throw new IllegalArgumentException("Indexed value not found: " + name); return child.asLong(); }
/** Finds the child with the specified name and returns it as a long. Returns defaultValue if not found. */ public long getLong (String name, long defaultValue) { JsonValue child = get(name); return (child == null || !child.isValue() || child.isNull()) ? defaultValue : child.asLong(); }
/** Finds the child with the specified name and returns it as a long. Returns defaultValue if not found. */ public long getLong (String name, long defaultValue) { JsonValue child = get(name); return (child == null || !child.isValue() || child.isNull()) ? defaultValue : child.asLong(); }
} else if (object.isDouble()) { double doubleValue = object.asDouble(); long longValue = object.asLong(); writer.append(Double.toString(doubleValue == longValue ? longValue : doubleValue)); } else if (object.isLong()) { writer.append(Long.toString(object.asLong())); } else if (object.isBoolean()) { writer.append(Boolean.toString(object.asBoolean()));
} else if (object.isDouble()) { double doubleValue = object.asDouble(); long longValue = object.asLong(); writer.append(Double.toString(doubleValue == longValue ? longValue : doubleValue)); } else if (object.isLong()) { writer.append(Long.toString(object.asLong())); } else if (object.isBoolean()) { writer.append(Boolean.toString(object.asBoolean()));
if (type == null || type == float.class || type == Float.class) return (T)(Float)jsonData.asFloat(); 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 == null || type == float.class || type == Float.class) return (T)(Float)jsonData.asFloat(); 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();
} else if (object.isDouble()) { double doubleValue = object.asDouble(); long longValue = object.asLong(); buffer.append(doubleValue == longValue ? longValue : doubleValue); } else if (object.isLong()) { buffer.append(object.asLong()); } else if (object.isBoolean()) { buffer.append(object.asBoolean());
} else if (object.isDouble()) { double doubleValue = object.asDouble(); long longValue = object.asLong(); buffer.append(doubleValue == longValue ? longValue : doubleValue); } else if (object.isLong()) { buffer.append(object.asLong()); } else if (object.isBoolean()) { buffer.append(object.asBoolean());
} else if (value.isLong()) { if (value.name != null) name(value.name); value(value.asLong()); } else if (value.isString()) { if (value.name != null) name(value.name);
} else if (value.isLong()) { if (value.name != null) name(value.name); value(value.asLong()); } else if (value.isString()) { if (value.name != null) name(value.name);
} else if (object.isDouble()) { double doubleValue = object.asDouble(); long longValue = object.asLong(); buffer.append(doubleValue == longValue ? longValue : doubleValue); } else if (object.isLong()) { buffer.append(object.asLong()); } else if (object.isBoolean()) { buffer.append(object.asBoolean());
} else if (object.isDouble()) { double doubleValue = object.asDouble(); long longValue = object.asLong(); buffer.append(doubleValue == longValue ? longValue : doubleValue); } else if (object.isLong()) { buffer.append(object.asLong()); } else if (object.isBoolean()) { buffer.append(object.asBoolean());
/** Finds the child with the specified index and returns it as a long. * @throws IllegalArgumentException if the child was not found. */ public long getLong (int index) { JsonValue child = get(index); if (child == null) throw new IllegalArgumentException("Indexed value not found: " + name); return child.asLong(); }
/** Finds the child with the specified name and returns it as a long. * @throws IllegalArgumentException if the child was not found. */ public long getLong (String name) { JsonValue child = get(name); if (child == null) throw new IllegalArgumentException("Named value not found: " + name); return child.asLong(); }
/** Finds the child with the specified name and returns it as a long. Returns defaultValue if not found. */ public long getLong (String name, long defaultValue) { JsonValue child = get(name); return (child == null || !child.isValue() || child.isNull()) ? defaultValue : child.asLong(); }
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; }