Package org.json

Examples of org.json.JSONObject.optJSONObject()


            LOGGER.log(Level.ERROR, "Gets users failed", e);

            throw new ServiceException(e);
        }

        final int pageCount = result.optJSONObject(Pagination.PAGINATION).optInt(Pagination.PAGINATION_PAGE_COUNT);

        final JSONObject pagination = new JSONObject();

        ret.put(Pagination.PAGINATION, pagination);
        final List<Integer> pageNums = Paginator.paginate(currentPageNum, pageSize, pageCount, windowSize);
View Full Code Here


            LOGGER.log(Level.SEVERE, "Gets users failed", e);

            throw new ServiceException(e);
        }

        final int pageCount = result.optJSONObject(Pagination.PAGINATION).
                optInt(Pagination.PAGINATION_PAGE_COUNT);

        final JSONObject pagination = new JSONObject();
        ret.put(Pagination.PAGINATION, pagination);
        final List<Integer> pageNums = Paginator.paginate(currentPageNum, pageSize, pageCount, windowSize);
View Full Code Here

    String method = message.optString("method");
    JSONObject params = message.optJSONObject("params");

    if (NODE_INSERTED.equals(method) && params != null
        && "IFRAME".equals(params.optJSONObject("node").optString("nodeName"))) {
      if (log.isLoggable(Level.FINE))
        log.fine("ChildIframeInserted " + message);
      return true;
    }
    if (NODE_INSERTED.equals(method) && params != null
View Full Code Here

      if (log.isLoggable(Level.FINE))
        log.fine("ChildIframeInserted " + message);
      return true;
    }
    if (NODE_INSERTED.equals(method) && params != null
        && "FRAME".equals(params.optJSONObject("node").optString("nodeName"))) {
      if (log.isLoggable(Level.FINE))
        log.fine("ChildIframeInserted " + message);
      return true;
    }
    return false;
View Full Code Here

            JSONObject jsonObject = this.jsonObject;

            if (!"".equals(path)) {
                for (String segment : PathUtils.elements(path)) {
                    LOG.debug(String.format("Checking segment %s of path %s in object %s", segment, path, jsonObject));
                    jsonObject = jsonObject.optJSONObject(segment);
                    if (jsonObject == null) {
                        throw new Exception(String.format("The path %s was not found in the current state", path));
                    }
                }
            }
View Full Code Here

    }

    private static void assertPropertyExists(String path, String property, JSONObject result) throws Exception {
        JSONObject temp = result;
        for (String segment : PathUtils.elements(path)) {
            temp = temp.optJSONObject(segment);

            if (temp == null) {
                throw new Exception(String.format("The node %s could not be found!", path));
            }
        }
View Full Code Here

        JSONObject blogSyncCSDNBlog = null;
        try {
            result = eventData.getJSONObject(Keys.RESULTS);
            final JSONObject status = result.getJSONObject(Keys.STATUS);

            events = status.optJSONObject(Keys.EVENTS);
            if (null == events) {
                events = new JSONObject();
                status.put(Keys.EVENTS, events);
            }
View Full Code Here

        JSONObject blogSyncCSDNBlog = null;
        try {
            result = eventData.getJSONObject(Keys.RESULTS);
            final JSONObject status = result.getJSONObject(Keys.STATUS);

            events = status.optJSONObject(Keys.EVENTS);
            if (null == events) {
                events = new JSONObject();
                status.put(Keys.EVENTS, events);
            }
View Full Code Here

        JSONObject blogSyncCSDNBlog = null;
        try {
            result = eventData.getJSONObject(Keys.RESULTS);
            final JSONObject status = result.getJSONObject(Keys.STATUS);

            events = status.optJSONObject(Keys.EVENTS);
            if (null == events) {
                events = new JSONObject();
                status.put(Keys.EVENTS, events);
            }
View Full Code Here

        JSONObject blogSyncCnBlogs = null;
        try {
            result = eventData.getJSONObject(Keys.RESULTS);
            final JSONObject status = result.getJSONObject(Keys.STATUS);

            events = status.optJSONObject(Keys.EVENTS);
            if (null == events) {
                events = new JSONObject();
                status.put(Keys.EVENTS, events);
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.