Package net.sf.json

Examples of net.sf.json.JSONObject.containsKey()


    }
  }
 
  private DoubanShuoRelation determineRelation (String result) {
    JSONObject obj = JSONObject.fromObject(result.trim());
    if (obj.containsKey("source") && obj.containsKey("target")) {
      JSONObject source = obj.getJSONObject("source");
      boolean following = source.getBoolean("following");
      boolean followedBy = source.getBoolean("followed_by");
      if (following && (!followedBy)) {
        return DoubanShuoRelation.FollowingOnly;
View Full Code Here


    }
  }
 
  private DoubanShuoRelation determineRelation (String result) {
    JSONObject obj = JSONObject.fromObject(result.trim());
    if (obj.containsKey("source") && obj.containsKey("target")) {
      JSONObject source = obj.getJSONObject("source");
      boolean following = source.getBoolean("following");
      boolean followedBy = source.getBoolean("followed_by");
      if (following && (!followedBy)) {
        return DoubanShuoRelation.FollowingOnly;
View Full Code Here

    }
    System.out.println("got result !");
    System.out.println(responseStr);
    JSONObject jObj = Converters.toJsonObj(responseStr);
    AccessToken token = new AccessToken();
    if (jObj.containsKey("access_token")) {
      String accessToken = jObj.getString("access_token");
      token.setAccessToken(accessToken);
    } else {
      throw ErrorHandler.cannotGetAccessToken();
    }
View Full Code Here

      String accessToken = jObj.getString("access_token");
      token.setAccessToken(accessToken);
    } else {
      throw ErrorHandler.cannotGetAccessToken();
    }
    if (jObj.containsKey("expires_in")) {
      int expiresIn = jObj.getInt("expires_in");
      token.setExpiresIn(expiresIn);
    } else {
      throw ErrorHandler.cannotGetAccessToken();
    }
View Full Code Here

      int expiresIn = jObj.getInt("expires_in");
      token.setExpiresIn(expiresIn);
    } else {
      throw ErrorHandler.cannotGetAccessToken();
    }
    if (jObj.containsKey("refresh_token")) {
      String refreshToken = jObj.getString("refresh_token");
      token.setRefreshToken(refreshToken);
    }
    if (jObj.containsKey("douban_user_id")) {
      String doubanUserId = jObj.getString("douban_user_id");
View Full Code Here

    }
    if (jObj.containsKey("refresh_token")) {
      String refreshToken = jObj.getString("refresh_token");
      token.setRefreshToken(refreshToken);
    }
    if (jObj.containsKey("douban_user_id")) {
      String doubanUserId = jObj.getString("douban_user_id");
      token.setDoubanUserId(doubanUserId);
    }
    return token;
  }
View Full Code Here

    public void testServiceExists() throws Exception {
        JSON json = getAsJSON("/pdf/info.json");

        assertTrue(json instanceof JSONObject);
        JSONObject obj = (JSONObject) json;
        assertTrue(obj.containsKey("scales"));
        assertTrue(obj.containsKey("dpis"));
        assertTrue(obj.containsKey("layouts"));
        assertTrue(obj.containsKey("printURL"));
        assertTrue(obj.containsKey("createURL"));
    }
View Full Code Here

        JSON json = getAsJSON("/pdf/info.json");

        assertTrue(json instanceof JSONObject);
        JSONObject obj = (JSONObject) json;
        assertTrue(obj.containsKey("scales"));
        assertTrue(obj.containsKey("dpis"));
        assertTrue(obj.containsKey("layouts"));
        assertTrue(obj.containsKey("printURL"));
        assertTrue(obj.containsKey("createURL"));
    }
}
View Full Code Here

        assertTrue(json instanceof JSONObject);
        JSONObject obj = (JSONObject) json;
        assertTrue(obj.containsKey("scales"));
        assertTrue(obj.containsKey("dpis"));
        assertTrue(obj.containsKey("layouts"));
        assertTrue(obj.containsKey("printURL"));
        assertTrue(obj.containsKey("createURL"));
    }
}
View Full Code Here

        assertTrue(json instanceof JSONObject);
        JSONObject obj = (JSONObject) json;
        assertTrue(obj.containsKey("scales"));
        assertTrue(obj.containsKey("dpis"));
        assertTrue(obj.containsKey("layouts"));
        assertTrue(obj.containsKey("printURL"));
        assertTrue(obj.containsKey("createURL"));
    }
}
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.