@Test public void testToJSONObject() throws Exception { String httpPath = "www.parse.com"; JSONObject jsonParameters = new JSONObject() .put("count", 1) .put("limit", 1); String sessionToken = "sessionToken"; String localId = "localId"; ParseRESTCommand command = new ParseRESTCommand.Builder() .httpPath(httpPath) .jsonParameters(jsonParameters) .method(ParseHttpRequest.Method.POST) .sessionToken(sessionToken) .localId(localId) .build(); JSONObject json = command.toJSONObject(); assertEquals(httpPath, json.getString("httpPath")); assertEquals("POST", json.getString("httpMethod")); assertEquals(jsonParameters, json.getJSONObject("parameters"), JSONCompareMode.NON_EXTENSIBLE); assertEquals(sessionToken, json.getString("sessionToken")); assertEquals(localId, json.getString("localId")); }
public JSONObject toJSONObject() { JSONObject jsonObject = new JSONObject(); try { if (httpPath != null) { jsonObject.put("httpPath", httpPath); } jsonObject.put("httpMethod", method.toString()); if (jsonParameters != null) { jsonObject.put("parameters", jsonParameters); } if (sessionToken != null) { jsonObject.put("sessionToken", sessionToken); } if (localId != null) { jsonObject.put("localId", localId); } } catch (JSONException e) { throw new RuntimeException(e.getMessage()); } return jsonObject; }
ParseRESTCommand extends ParseRequest<JSONObject> { public JSONObject toJSONObject() { JSONObject jsonObject = new JSONObject(); try { if (httpPath != null) { jsonObject.put("httpPath", httpPath); } jsonObject.put("httpMethod", method.toString()); if (jsonParameters != null) { jsonObject.put("parameters", jsonParameters); } if (sessionToken != null) { jsonObject.put("sessionToken", sessionToken); } if (localId != null) { jsonObject.put("localId", localId); } } catch (JSONException e) { throw new RuntimeException(e.getMessage()); } return jsonObject; } }
ParseRESTCommand extends ParseRequest<JSONObject> { public JSONObject toJSONObject() { JSONObject jsonObject = new JSONObject(); try { if (httpPath != null) { jsonObject.put("httpPath", httpPath); } jsonObject.put("httpMethod", method.toString()); if (jsonParameters != null) { jsonObject.put("parameters", jsonParameters); } if (sessionToken != null) { jsonObject.put("sessionToken", sessionToken); } if (localId != null) { jsonObject.put("localId", localId); } } catch (JSONException e) { throw new RuntimeException(e.getMessage()); } return jsonObject; } ParseRESTCommand(
            String httpPath,
            ParseHttpRequest.Method httpMethod,
            Map<String, ?> parameters,
            String sessionToken);  ParseRESTCommand(
            String httpPath,
            ParseHttpRequest.Method httpMethod,
            JSONObject jsonParameters,
            String sessionToken); private  ParseRESTCommand(
            String httpPath,
            ParseHttpRequest.Method httpMethod,
            JSONObject jsonParameters,
            String localId, String sessionToken);   ParseRESTCommand(Init<?> builder); }
ParseRESTCommand extends ParseRequest<JSONObject> { public JSONObject toJSONObject() { JSONObject jsonObject = new JSONObject(); try { if (httpPath != null) { jsonObject.put("httpPath", httpPath); } jsonObject.put("httpMethod", method.toString()); if (jsonParameters != null) { jsonObject.put("parameters", jsonParameters); } if (sessionToken != null) { jsonObject.put("sessionToken", sessionToken); } if (localId != null) { jsonObject.put("localId", localId); } } catch (JSONException e) { throw new RuntimeException(e.getMessage()); } return jsonObject; } ParseRESTCommand(
            String httpPath,
            ParseHttpRequest.Method httpMethod,
            Map<String, ?> parameters,
            String sessionToken);  ParseRESTCommand(
            String httpPath,
            ParseHttpRequest.Method httpMethod,
            JSONObject jsonParameters,
            String sessionToken); private  ParseRESTCommand(
            String httpPath,
            ParseHttpRequest.Method httpMethod,
            JSONObject jsonParameters,
            String localId, String sessionToken);   ParseRESTCommand(Init<?> builder); static ParseRESTCommand fromJSONObject(JSONObject jsonObject); @Override Task<JSONObject> executeAsync(
            final ParseHttpClient client,
            final ProgressCallback uploadProgressCallback,
            final ProgressCallback downloadProgressCallback,
            final Task<Void> cancellationToken); String getCacheKey(); JSONObject toJSONObject(); String getSessionToken(); String getOperationSetUUID(); String getLocalId(); void setLocalId(String localId); void resolveLocalIds(); void retainLocalIds(); void releaseLocalIds(); }
ParseRESTCommand extends ParseRequest<JSONObject> { public JSONObject toJSONObject() { JSONObject jsonObject = new JSONObject(); try { if (httpPath != null) { jsonObject.put("httpPath", httpPath); } jsonObject.put("httpMethod", method.toString()); if (jsonParameters != null) { jsonObject.put("parameters", jsonParameters); } if (sessionToken != null) { jsonObject.put("sessionToken", sessionToken); } if (localId != null) { jsonObject.put("localId", localId); } } catch (JSONException e) { throw new RuntimeException(e.getMessage()); } return jsonObject; } ParseRESTCommand(
            String httpPath,
            ParseHttpRequest.Method httpMethod,
            Map<String, ?> parameters,
            String sessionToken);  ParseRESTCommand(
            String httpPath,
            ParseHttpRequest.Method httpMethod,
            JSONObject jsonParameters,
            String sessionToken); private  ParseRESTCommand(
            String httpPath,
            ParseHttpRequest.Method httpMethod,
            JSONObject jsonParameters,
            String localId, String sessionToken);   ParseRESTCommand(Init<?> builder); static ParseRESTCommand fromJSONObject(JSONObject jsonObject); @Override Task<JSONObject> executeAsync(
            final ParseHttpClient client,
            final ProgressCallback uploadProgressCallback,
            final ProgressCallback downloadProgressCallback,
            final Task<Void> cancellationToken); String getCacheKey(); JSONObject toJSONObject(); String getSessionToken(); String getOperationSetUUID(); String getLocalId(); void setLocalId(String localId); void resolveLocalIds(); void retainLocalIds(); void releaseLocalIds(); public String masterKey; }