本文整理了Java中net.minidev.json.JSONObject.getAsNumber()
方法的一些代码示例,展示了JSONObject.getAsNumber()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.getAsNumber()
方法的具体详情如下:
包路径:net.minidev.json.JSONObject
类名称:JSONObject
方法名:getAsNumber
[英]A Simple Helper cast an Object to an Number
[中]简单的辅助对象将对象强制转换为数字
代码示例来源:origin: ScienJus/pixiv-crawler
/**
* 获得排行榜下一页页数
* @param json
* @return
*/
public int parseRankNextPage(JSONObject json) {
Number nextPage = json.getAsNumber("next");
if (nextPage == null) {
return -1;
}
return nextPage.intValue();
}
代码示例来源:origin: apache/tajo
case INT1:
case INT2:
Number int2Num = object.getAsNumber(fieldName);
if (int2Num != null) {
output.put(fieldIndex, DatumFactory.createInt2(int2Num.shortValue()));
Number int4Num = object.getAsNumber(fieldName);
if (int4Num != null) {
output.put(fieldIndex, DatumFactory.createInt4(int4Num.intValue()));
Number int8Num = object.getAsNumber(fieldName);
if (int8Num != null) {
output.put(fieldIndex, DatumFactory.createInt8(int8Num.longValue()));
Number float4Num = object.getAsNumber(fieldName);
if (float4Num != null) {
output.put(fieldIndex, DatumFactory.createFloat4(float4Num.floatValue()));
Number float8Num = object.getAsNumber(fieldName);
if (float8Num != null) {
output.put(fieldIndex, DatumFactory.createFloat8(float8Num.doubleValue()));
代码示例来源:origin: org.apache.tajo/tajo-storage-hdfs
case INT1:
case INT2:
Number int2Num = object.getAsNumber(fieldName);
if (int2Num != null) {
output.put(fieldIndex, DatumFactory.createInt2(int2Num.shortValue()));
Number int4Num = object.getAsNumber(fieldName);
if (int4Num != null) {
output.put(fieldIndex, DatumFactory.createInt4(int4Num.intValue()));
Number int8Num = object.getAsNumber(fieldName);
if (int8Num != null) {
output.put(fieldIndex, DatumFactory.createInt8(int8Num.longValue()));
Number float4Num = object.getAsNumber(fieldName);
if (float4Num != null) {
output.put(fieldIndex, DatumFactory.createFloat4(float4Num.floatValue()));
Number float8Num = object.getAsNumber(fieldName);
if (float8Num != null) {
output.put(fieldIndex, DatumFactory.createFloat8(float8Num.doubleValue()));
内容来源于网络,如有侵权,请联系作者删除!