Package org.json

Examples of org.json.JSONObject.optInt()


      log.severe("no method in request");
      return JSONRPCResult.ERR_NOMETHOD;
  }

  // Is this a CallableReference it will have a non-zero objectID
  int object_id = json_req.optInt("objectID");
  if(json_bridge.isDebug())
      if(object_id != 0)
    log.fine("call " + "objectID=" + object_id + " " +
       methodName + "(" + arguments + ")");
      else
View Full Code Here


            {
                String methodName = json_req.getString("method");
                JSONArray arguments = json_req.getJSONArray("params");

                // If this a CallableReference it will have a non-zero objectID
                int object_id = json_req.optInt("objectID");
                StringBuffer sb = new StringBuffer(".doprocessCall(): call ");
                if (object_id != 0)
                {
                    sb.append("objectID=").append(object_id).append(" ");
                }
View Full Code Here

      l.onMessage(message);
    }

    if (message instanceof ApplicationDataMessage) {
      JSONObject content = ((ApplicationDataMessage) message).getMessage();
      if ((content.optInt("id", -1) != -1)) {
        defaultFinder.addResponse(content);
      }
    }
  }
View Full Code Here

      return value.toString();
    }
    if (value instanceof JSONObject) {
      JSONObject v = (JSONObject) value;
      if (v.has("ELEMENT")) {
        Integer i = v.optInt("ELEMENT");
        return "UIAutomation.cache.get(" + i + ",false)";
      } else {
        return v.toString();
      }
    }
View Full Code Here

        request.getVariableValue(":reference"),
        payload.optDouble("xstart"),
        payload.optDouble("ystart"),
        payload.optDouble("xend"),
        payload.optDouble("yend"),
        payload.optInt("touchCount"));
    setJS(js);
  }

  @Override
  public JSONObject configurationDescription() throws JSONException {
View Full Code Here

      return value.toString();
    }
    if (value instanceof JSONObject) {
      JSONObject v = (JSONObject) value;
      if (v.has("ELEMENT")) {
        Integer i = v.optInt("ELEMENT");
        return "UIAutomation.cache.get(" + i + ",false)";
      } else {
        return v.toString();
      }
    }
View Full Code Here

  }

  public RemoteWebElement findElementByCSSSelector(String selector) {
    JSONObject response = inspector.sendCommand(DOM.querySelector(nodeId, selector));
    // TODO freynaud
    NodeId id = new NodeId(response.optInt("nodeId"));
    if (!id.exist()) {
      throw new NoSuchElementException("no element matching " + selector);
    }
    RemoteWebElement res = new RemoteWebElement(id, inspector);
    return res;
View Full Code Here

        assertNotNull(converted);

        // with no embedded types the key (which is a vertex) simply serializes out to an id
        // {"result":{"1":1000},"code":200,"requestId":"2d62161b-9544-4f39-af44-62ec49f9a595","type":0}
        assertEquals(1000, converted.optInt("1"));
    }

    @Test
    public void deserializeRequestNicelyWithNoArgs() throws Exception {
        final UUID request = UUID.fromString("011CFEE9-F640-4844-AC93-034448AC0E80");
View Full Code Here

    if (serviceType != null && serviceType.equalsIgnoreCase(INSERT_GOAL_DETAILS)) {
      logger.debug("Adding the details of the goal node: ");
      List<GoalKpi> kpisList = new ArrayList<GoalKpi>();
      JSONObject JSONGoalDetails =  getAttributeAsJSONObject("goalDetails");
      JSONObject goalNode =  JSONGoalDetails.optJSONObject("goalNode");
      Integer goalNodeId =  goalNode.optInt("id");
      String goalDesc =  goalNode.optString("goalDesc");
      String goalName =  goalNode.optString("name");
      logger.debug(goalNode);
      GoalNode gn = new GoalNode(goalName, "", goalDesc, null, null);
      gn.setId(goalNodeId);
View Full Code Here

   
    for(int i=0; i<JSONGrantNodes.length(); i++){
      JSONObject JSONGrantNode = JSONGrantNodes.getJSONObject(i);
      int modelInstanceId = JSONGrantNode.getInt("modelinstance");
      try{
        Integer modelInstancesToUncheck = JSONGrantNode.optInt("childrenToUncheck");
        if(miChildrenToUncheckList.indexOf(modelInstancesToUncheck) == -1){
          miChildrenToUncheckList.add(modelInstancesToUncheck);       
       
          if(modelInstancesToUncheck!=null){
         
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.