public static StemContractStateValue of(JsonObject json) { return new StemContractStateValue(json.deepCopy()); }
public static JsonObject protoAsJson(JsonObject template, Message source) { JsonObject body = template.deepCopy(); source.getDescriptorForType().getFields().forEach(item -> body.add(item.getJsonName(), new Gson().toJsonTree(source.getField(item)).getAsJsonPrimitive())); return body; }
@Override public GenericJsonEvent copy() { if (this.payload != null) { return new GenericJsonEvent(this.payload.deepCopy()); } else { return new GenericJsonEvent(null); } } }
@Override public GenericJsonEvent copy() { if (this.payload != null) { return new GenericJsonEvent(this.payload.deepCopy()); } else { return new GenericJsonEvent(null); } } }
/** * Returns the updated JSON request message, when the HTTP method * points to PUT or PATCH. * * @param req current JSON request message * @param nodeName root node name * @param modName module name of the root node * @return update JSON request message */ private String getUpdatedJsonReq(String req, String nodeName, String modName) { Writer writer = new StringWriter(); JsonWriter jsonWriter = new JsonWriter(writer); jsonWriter.setIndent(repeat(" ", 4)); JsonParser jsonParser = new JsonParser(); JsonObject oldJson = (JsonObject)jsonParser.parse(req); oldJson = remChildModName(oldJson, modName); JsonObject newJson = new JsonObject(); newJson.add(modName + COLON + nodeName, oldJson.deepCopy()); Gson gson= new Gson(); gson.toJson(newJson, jsonWriter); return writer.toString(); }
Observable.create(emitter -> { final String subscriberId = UUID.randomUUID().toString(); final JsonObject params = rawParams.deepCopy(); params.addProperty("subscriberId", subscriberId);