Package org.json

Examples of org.json.JSONObject.optBoolean()


        JSONObject json = OTJson.object("string", "string", "int", 123, "double", 123.456, "true", true, "false", false, "null", null);
        Assert.assertNotNull(json);
        Assert.assertEquals("string", json.optString("string"));
        Assert.assertEquals(123, json.optInt("int"));
        Assert.assertEquals(123.456, json.optDouble("double"), 1e-15);
        Assert.assertEquals(true, json.optBoolean("true"));
        Assert.assertEquals(false, json.optBoolean("false"));
        Assert.assertEquals(null, json.opt("null"));
    }

    @Test
View Full Code Here


        Assert.assertNotNull(json);
        Assert.assertEquals("string", json.optString("string"));
        Assert.assertEquals(123, json.optInt("int"));
        Assert.assertEquals(123.456, json.optDouble("double"), 1e-15);
        Assert.assertEquals(true, json.optBoolean("true"));
        Assert.assertEquals(false, json.optBoolean("false"));
        Assert.assertEquals(null, json.opt("null"));
    }

    @Test
    public void testArray() {
View Full Code Here

    // Check if denial email must be sent
    boolean sendDenialEmail = false;
    JSONObject denialEmail = submissionInfo.optJSONObject("denial_email");
    if( null != denialEmail ){
      boolean requested = denialEmail.optBoolean("requested",false);
      boolean sent = denialEmail.optBoolean("sent",false);
     
      if( requested && !sent ){
        sendDenialEmail = true;
      }
View Full Code Here

    // Check if denial email must be sent
    boolean sendDenialEmail = false;
    JSONObject denialEmail = submissionInfo.optJSONObject("denial_email");
    if( null != denialEmail ){
      boolean requested = denialEmail.optBoolean("requested",false);
      boolean sent = denialEmail.optBoolean("sent",false);
     
      if( requested && !sent ){
        sendDenialEmail = true;
      }
    }
View Full Code Here

    }
  }

  public void performApprovedWork(JSONObject submissionDoc, JSONObject currentDoc) throws Exception {
    JSONObject submissionInfo = submissionDoc.getJSONObject("nunaliit_submission");
    boolean isDeletion = submissionInfo.optBoolean("deletion",false);
    String docId = SubmissionUtils.getDocumentIdentifierFromSubmission(submissionDoc);
   
    if( null == currentDoc ) {
      // New document. Create.
      JSONObject originalDoc = SubmissionUtils.getApprovedDocumentFromSubmission(submissionDoc);
View Full Code Here

                classPackage = root.getString("package");
                className = root.getString("name");
                superClassPackage = JsonUtils.getStringFixFalseNull(root, "superClassPackage");
                superClassName = JsonUtils.getStringFixFalseNull(root, "superClassName");
                isSuperClassParcelable = root.optBoolean("isSuperClassParcelable");
                hasSubClasses = root.optBoolean("hasSubClasses");
                if (hasSubClasses) {
                    isAbstract = root.optBoolean("isAbstract");
                } else {
                    isAbstract = false;
View Full Code Here

                classPackage = root.getString("package");
                className = root.getString("name");
                superClassPackage = JsonUtils.getStringFixFalseNull(root, "superClassPackage");
                superClassName = JsonUtils.getStringFixFalseNull(root, "superClassName");
                isSuperClassParcelable = root.optBoolean("isSuperClassParcelable");
                hasSubClasses = root.optBoolean("hasSubClasses");
                if (hasSubClasses) {
                    isAbstract = root.optBoolean("isAbstract");
                } else {
                    isAbstract = false;
                }
View Full Code Here

                superClassPackage = JsonUtils.getStringFixFalseNull(root, "superClassPackage");
                superClassName = JsonUtils.getStringFixFalseNull(root, "superClassName");
                isSuperClassParcelable = root.optBoolean("isSuperClassParcelable");
                hasSubClasses = root.optBoolean("hasSubClasses");
                if (hasSubClasses) {
                    isAbstract = root.optBoolean("isAbstract");
                } else {
                    isAbstract = false;
                }

                JSONArray fieldJsonArray = root.optJSONArray("fields");
View Full Code Here

                Map<String, String> facetProps = new HashMap<String, String>();
                facetProps.put("type", type);
                facetProps.put("column", fieldName);
                JSONObject column = columnMap.get(fieldName);
                String columnType = (column == null) ? "" : column.optString("type", "");
                if (column != null && column.opt("activity") != null && column.optBoolean("activity")) {
                    columnType = "aint";
                }
                facetProps.put("column_type", columnType);
                facetProps.put("depends", dependSet.toString());
View Full Code Here

                if (type.equals("simple")) {
                    facetHandler = buildSimpleFacetHandler(name, fieldName, dependSet, termListFactoryMap.get(fieldName), invertedIndexPenalty);
                } else if (type.equals("path")) {
                    facetHandler = buildPathHandler(name, fieldName, paramMap, invertedIndexPenalty);
                } else if (type.equals("range")) {
                    if (column.optBoolean("multi")) {
                        facetHandler = new MultiRangeFacetHandler(name, fieldName, null, termListFactoryMap.get(fieldName),
                                buildPredefinedRanges(paramMap));
                    } else {
                        facetHandler = buildRangeHandler(name, fieldName, termListFactoryMap.get(fieldName), paramMap);
                    }
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.