/** * Get an optional BigInteger associated with a key, or the defaultValue if * there is no such key or if its value is not a number. If the value is a * string, an attempt will be made to evaluate it as a number. * * @param key * A key string. * @param defaultValue * The default. * @return An object which is the value. */ public BigInteger optBigInteger(String key, BigInteger defaultValue) { Object val = this.opt(key); return objectToBigInteger(val, defaultValue); }
/** * Get the optional BigInteger value associated with an index. The * defaultValue is returned if there is no value for the index, or if the * value is not a number and cannot be converted to a number. * * @param index * The index must be between 0 and length() - 1. * @param defaultValue * The default value. * @return The value. */ public BigInteger optBigInteger(int index, BigInteger defaultValue) { Object val = this.opt(index); return JSONObject.objectToBigInteger(val, defaultValue); }
/** * Get the BigInteger value associated with an index. * * @param index * The index must be between 0 and length() - 1. * @return The value. * @throws JSONException * If the key is not found or if the value cannot be converted * to a BigInteger. */ public BigInteger getBigInteger (int index) throws JSONException { Object object = this.get(index); BigInteger val = JSONObject.objectToBigInteger(object, null); if(val == null) { throw new JSONException("JSONArray[" + index + "] could not convert to BigDecimal ("+ object + ")."); } return val; }
/** * Get the BigInteger value associated with a key. * * @param key * A key string. * @return The numeric value. * @throws JSONException * if the key is not found or if the value cannot * be converted to BigInteger. */ public BigInteger getBigInteger(String key) throws JSONException { Object object = this.get(key); BigInteger ret = objectToBigInteger(object, null); if (ret != null) { return ret; } throw new JSONException("JSONObject[" + quote(key) + "] could not be converted to BigInteger (" + object + ")."); }
/** * Get the optional BigInteger value associated with an index. The * defaultValue is returned if there is no value for the index, or if the * value is not a number and cannot be converted to a number. * * @param index * The index must be between 0 and length() - 1. * @param defaultValue * The default value. * @return The value. */ public BigInteger optBigInteger(int index, BigInteger defaultValue) { Object val = this.opt(index); return JSONObject.objectToBigInteger(val, defaultValue); }
/** * Get an optional BigInteger associated with a key, or the defaultValue if * there is no such key or if its value is not a number. If the value is a * string, an attempt will be made to evaluate it as a number. * * @param key * A key string. * @param defaultValue * The default. * @return An object which is the value. */ public BigInteger optBigInteger(String key, BigInteger defaultValue) { Object val = this.opt(key); return objectToBigInteger(val, defaultValue); }
/** * Get the BigInteger value associated with an index. * * @param index * The index must be between 0 and length() - 1. * @return The value. * @throws JSONException * If the key is not found or if the value cannot be converted * to a BigInteger. */ public BigInteger getBigInteger (int index) throws JSONException { Object object = this.get(index); BigInteger val = JSONObject.objectToBigInteger(object, null); if(val == null) { throw new JSONException("JSONArray[" + index + "] could not convert to BigDecimal ("+ object + ")."); } return val; }
/** * Get the BigInteger value associated with a key. * * @param key * A key string. * @return The numeric value. * @throws JSONException * if the key is not found or if the value cannot * be converted to BigInteger. */ public BigInteger getBigInteger(String key) throws JSONException { Object object = this.get(key); BigInteger ret = objectToBigInteger(object, null); if (ret != null) { return ret; } throw new JSONException("JSONObject[" + quote(key) + "] could not be converted to BigInteger (" + object + ")."); }