本文整理了Java中org.json.JSONObject.objectToBigInteger()
方法的一些代码示例,展示了JSONObject.objectToBigInteger()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.objectToBigInteger()
方法的具体详情如下:
包路径:org.json.JSONObject
类名称:JSONObject
方法名:objectToBigInteger
暂无
代码示例来源:origin: b3log/latke
/**
* 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);
}
代码示例来源:origin: b3log/latke
/**
* 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);
}
代码示例来源:origin: b3log/latke
/**
* 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;
}
代码示例来源:origin: b3log/latke
/**
* 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 + ").");
}
代码示例来源:origin: org.b3log/latke
/**
* 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);
}
代码示例来源:origin: org.b3log/latke
/**
* 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);
}
代码示例来源:origin: org.b3log/latke
/**
* 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;
}
代码示例来源:origin: org.b3log/latke
/**
* 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 + ").");
}
内容来源于网络,如有侵权,请联系作者删除!