當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。