Java Code Examples for org.kurento.jsonrpc.JsonUtils#toJsonObject()
The following examples show how to use
org.kurento.jsonrpc.JsonUtils#toJsonObject() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RomJsonConverterTest.java From kurento-java with Apache License 2.0 | 6 votes |
@Test public void jsonToPropsConversion() { Props param = new Props(); param.add("prop1", "XXX"); param.add("prop2", 33); param.add("prop3", "YYY"); param.add("prop4", 5.5f); JsonObject jsonObject = JsonUtils.toJsonObject(param); assertEquals(jsonObject.get("prop1").getAsString(), "XXX"); assertEquals(jsonObject.get("prop2").getAsInt(), 33); assertEquals(jsonObject.get("prop3").getAsString(), "YYY"); assertEquals(jsonObject.get("prop4").getAsFloat(), 5.5f, 0.01); }
Example 2
Source File: KmsEvent.java From openvidu with Apache License 2.0 | 5 votes |
public JsonObject toJson() { JsonObject json = JsonUtils.toJsonObject(event); json.remove("tags"); json.remove("timestampMillis"); json.addProperty("timestamp", timestamp); json.addProperty("sessionId", participant.getSessionId()); json.addProperty("user", participant.getFinalUserId()); json.addProperty("connection", participant.getParticipantPublicId()); json.addProperty("endpoint", this.endpoint); json.addProperty("msSinceEndpointCreation", msSinceCreation); return json; }
Example 3
Source File: RomClientJsonRpcClient.java From kurento-java with Apache License 2.0 | 5 votes |
public RequestAndResponseType createUnsubscribeRequest(String objectRef, String listenerSubscription) { JsonObject params = JsonUtils.toJsonObject( new Props(UNSUBSCRIBE_OBJECT, objectRef).add(UNSUBSCRIBE_LISTENER, listenerSubscription)); return new RequestAndResponseType(new Request<>(UNSUBSCRIBE_METHOD, params), Void.class); }
Example 4
Source File: RomJsonConverterTest.java From kurento-java with Apache License 2.0 | 5 votes |
@Test public void jsonToObjectConversion() { ComplexParam param = new ComplexParam("XXX", 33); param.setProp3("YYY"); param.setProp4(5.5f); JsonObject jsonObject = JsonUtils.toJsonObject(param); assertEquals(jsonObject.get("prop1").getAsString(), "XXX"); assertEquals(jsonObject.get("prop2").getAsInt(), 33); assertEquals(jsonObject.get("prop3").getAsString(), "YYY"); assertEquals(jsonObject.get("prop4").getAsFloat(), 5.5f, 0.01); }
Example 5
Source File: RomClientJsonRpcClient.java From kurento-java with Apache License 2.0 | 3 votes |
public RequestAndResponseType createSubscribeRequest(String objectRef, String eventType) { JsonObject params = JsonUtils .toJsonObject(new Props(SUBSCRIBE_OBJECT, objectRef).add(SUBSCRIBE_TYPE, eventType)); return new RequestAndResponseType(new Request<>(SUBSCRIBE_METHOD, params), String.class); }
Example 6
Source File: RomClientJsonRpcClient.java From kurento-java with Apache License 2.0 | 2 votes |
public RequestAndResponseType createReleaseRequest(String objectRef) { JsonObject params = JsonUtils.toJsonObject(new Props(RELEASE_OBJECT, objectRef)); return new RequestAndResponseType(new Request<>(RELEASE_METHOD, params), Void.class); }