@Override public boolean asBoolean() { return value==Iv.N ? super.asBoolean() : value==Iv.T; }
@Override public boolean asBoolean() { return value==Iv.N ? super.asBoolean() : value==Iv.T; }
/** * Returns the <code>boolean</code> value of the member with the specified name in this object. If * this object does not contain a member with this name, the given default value is returned. If * this object contains multiple members with the given name, the last one will be picked. If this * member's value does not represent a JSON <code>true</code> or <code>false</code> value, an * exception is thrown. * * @param name * the name of the member whose value is to be returned * @param defaultValue * the value to be returned if the requested member is missing * @return the value of the last member with the specified name, or the given default value if * this object does not contain a member with that name */ public boolean getBoolean(String name, boolean defaultValue) { JsonValue value=get(name); return value!=null ? value.asBoolean() : defaultValue; }
/** * Returns the <code>boolean</code> value of the member with the specified name in this object. If * this object does not contain a member with this name, the given default value is returned. If * this object contains multiple members with the given name, the last one will be picked. If this * member's value does not represent a JSON <code>true</code> or <code>false</code> value, an * exception is thrown. * * @param name * the name of the member whose value is to be returned * @param defaultValue * the value to be returned if the requested member is missing * @return the value of the last member with the specified name, or the given default value if * this object does not contain a member with that name */ public boolean getBoolean(String name, boolean defaultValue) { JsonValue value=get(name); return value!=null ? value.asBoolean() : defaultValue; }
Object convertJsonToJava(final JsonValue value) throws PersistentStoreException { if (null == value) { return null; } else if (value.isString()) { return value.asString(); } else if (value.isNumber()) { return value.asDouble(); } else if (value.isBoolean()) { return value.asBoolean(); } else if (value.isArray()) { final List<Object> list = new ArrayList<>(); for (final JsonValue av : value.asArray()) { final Object o = this.convertJsonToJava(av); list.add(o); } return list; } else if (value.isObject()) { final Map<String, Object> map = new HashMap<>(); for (final String k : value.asObject().names()) { final JsonValue jv = value.asObject().get(k); final Object v = this.convertJsonToJava(jv); map.put(k, v); } return map; } else { throw new PersistentStoreException("Unknown JSON type.", null); } }
return t; } else if (value.isBoolean()) { final T t = this.af.createDatatype(itemType, value.asBoolean()); return t; } else if (value.isArray()) {