String createRequest(int id, String xsrfKey, String methodName, Collection<Object> args) { JsonRequest msg = new JsonRequest(); msg.method = methodName; if (args != null) { for (Object arg : args) { msg.params.add(arg); } } msg.id = id; msg.xsrfKey = xsrfKey; return gson.toJson(msg, msg.getClass()); }
public JsonRequestBuilder method(String method) { jsonRequest.method = method; return this; }