当前位置: 首页>>代码示例>>Java>>正文


Java JSONObject.getLongValue方法代码示例

本文整理汇总了Java中com.alibaba.fastjson.JSONObject.getLongValue方法的典型用法代码示例。如果您正苦于以下问题:Java JSONObject.getLongValue方法的具体用法?Java JSONObject.getLongValue怎么用?Java JSONObject.getLongValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.fastjson.JSONObject的用法示例。


在下文中一共展示了JSONObject.getLongValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doProcess

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
@Override
public final QCloudMsgResponse doProcess(String jsonBody,Map<String,Object> urlParams,String key) {
	JSONObject jsonObject = JSON.parseObject(jsonBody);
	String sign = jsonObject.getString("sign");
	long t = jsonObject.getLongValue("t");
	if (!isValid(t, key, sign)) {
		return onInvalidMsg(jsonBody);
	}
	int eventType = jsonObject.getIntValue("event_type");
	switch (eventType) {
	case LiveMsgEventType.CUT_STREAM:
		return onCutStream(JSON.parseObject(jsonBody, LiveMsgStreamEventDO.class));
	case LiveMsgEventType.PUSH_STREAM:
		return onPushStream(JSON.parseObject(jsonBody, LiveMsgStreamEventDO.class));
	case LiveMsgEventType.RECORD_AV_CREATED:
		return onAvRecordCreated(JSON.parseObject(jsonBody, LiveMsgAvRecordCreatedDO.class));
	case LiveMsgEventType.SCREENSHOT_CREATED:
		return onScreenshotCreated(JSON.parseObject(jsonBody, LiveMsgScreenshotCreatedDO.class));
	default:
		break;
	}
	return LiveMsgResponse.FAILED;
}
 
开发者ID:51wakeup,项目名称:wakeup-qcloud-sdk,代码行数:24,代码来源:AbstractLiveMsgListener.java

示例2: testExecute

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
@Test
public void testExecute() throws ExecutionException, InterruptedException {

    ExecutorService exec = Executors.newCachedThreadPool();

    bodyContent = LianJiaCrawler.doGet(dataUrl, agentHeaderArr);
    jsonResult = JSON.parseObject(bodyContent, JsonResult.class);
    System.out.println(">>> dataUrl jsonResult: " + jsonResult.toString());

    if (200 == jsonResult.getStatus()) {
        JSONArray jsonArray = (JSONArray) jsonResult.getData();
        for (int i = 0; i < jsonArray.size(); i++) {

            JSONObject jsonObject = jsonArray.getJSONObject(i);
            Long id = jsonObject.getLongValue("id");

            for (int j = 0; j < threadSize; j++) {
                Future<String> future = exec.submit(new SecKillCallable(id,i + j));
                LOGGER.debug(">>> i future.get(): ", future.get());
            }
        }
    }

    exec.shutdown();

}
 
开发者ID:lupindong,项目名称:xq_seckill_microservice,代码行数:27,代码来源:SecKillTest.java

示例3: loadPositions

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
public void loadPositions(String json) {

        if (StringHelper.isEmpty(json)) {
            return;
        }

        Long inode = 0L, pos = 0L, number = 0L;
        String file = "";
        JSONArray positionRecords = JSONArray.parseArray(json);
        for (int i = 0; i < positionRecords.size(); i++) {
            JSONObject positionObject = (JSONObject) positionRecords.get(i);
            inode = positionObject.getLong("inode");
            pos = positionObject.getLong("pos");
            file = positionObject.getString("file");
            // add line number
            number = positionObject.getLongValue("num");
            for (Object v : Arrays.asList(inode, pos, file)) {
                Preconditions.checkNotNull(v, "Detected missing value in position file. " + "inode: " + inode
                        + ", pos: " + pos + ", path: " + file);
            }
            TailFile tf = tailFiles.get(inode);
            try {
                if (tf != null && tf.updatePos(file, inode, pos, number)) {
                    tailFiles.put(inode, tf);
                }
                else {
                    // add old tail file into memory
                    maybeReloadMap.put(inode, new Long[] { pos, number });
                    if (log.isDebugEnable()) {
                        log.debug(this, "add old&inInterrupt file: " + file + ", inode: " + inode + ", pos: " + pos);
                    }

                }
            }
            catch (IOException e) {
                log.err(this, "TailFile updatePos FAILED.", e);
            }
        }
    }
 
开发者ID:uavorg,项目名称:uavstack,代码行数:40,代码来源:ReliableTaildirEventReader.java

示例4: getAnnouncements

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
public static List<Announcement> getAnnouncements(String teamId, String announce, int limit) {
    if (TextUtils.isEmpty(announce)) {
        return null;
    }

    List<Announcement> announcements = new ArrayList<>();
    try {
        int count = 0;
        JSONArray jsonArray = JSONArray.parseArray(announce);
        for (int i = jsonArray.size() - 1; i >= 0; i--) {
            JSONObject json = jsonArray.getJSONObject(i);
            String id = json.getString(JSON_KEY_ID);
            String creator = json.getString(JSON_KEY_CREATOR);
            String title = json.getString(JSON_KEY_TITLE);
            long time = json.getLongValue(JSON_KEY_TIME);
            String content = json.getString(JSON_KEY_CONTENT);

            announcements.add(new Announcement(id, teamId, creator, title, time, content));

            if (++count >= limit) {
                break;
            }
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }

    return announcements;
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:30,代码来源:AnnouncementHelper.java

示例5: playUrl

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
@RequestMapping(value = "playUrl", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ReturnT<JSONArray> playUrl(Model model, HttpServletRequest request, @RequestParam("uid") String uid) {
    HeadPrinter.printHead(model);
    JSONObject jsonObject1 = JSONObject.parseObject(uid);
    long id = jsonObject1.getLongValue("uid");
    String result = NetEaseClient.getPlayUrl(id);
    JSONObject jsonObject = JSONObject.parseObject(result);
    String ly = "";
    JSONArray jsonArray = jsonObject.getJSONArray("data");
    return new ReturnT(jsonArray, ly);
}
 
开发者ID:wxz1211,项目名称:dooo,代码行数:13,代码来源:NetEaseController.java

示例6: deserialze

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
public <T> T deserialze(DefaultJSONParser parser, java.lang.reflect.Type type, Object fieldName) {
    JSONObject object = parser.parseObject();
    long id = object.getLongValue("id");
    return (T) Type.valueOf(id);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:EnumCustomCodecTest.java


注:本文中的com.alibaba.fastjson.JSONObject.getLongValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。