@Test public void deserializeTest() throws IOException { String json = "[70, 6131533, {}]"; YieldMessage yieldMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(yieldMessage.getCode()).isEqualTo(70); assertThat(yieldMessage.getRequestId()).isEqualTo(6131533L); assertThat(yieldMessage.getArguments()).isNull(); assertThat(yieldMessage.getArgumentsKw()).isNull(); json = "[70, 6131533, {}, [\"Hello, world!\"]]"; yieldMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(yieldMessage.getCode()).isEqualTo(70); assertThat(yieldMessage.getRequestId()).isEqualTo(6131533L); assertThat(yieldMessage.getArguments()).containsExactly("Hello, world!"); assertThat(yieldMessage.getArgumentsKw()).isNull(); json = "[70, 6131533, {}, [30]]"; yieldMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(yieldMessage.getCode()).isEqualTo(70); assertThat(yieldMessage.getRequestId()).isEqualTo(6131533L); assertThat(yieldMessage.getArguments()).containsExactly(30); assertThat(yieldMessage.getArgumentsKw()).isNull(); json = "[70, 6131533, {}, [], {\"userid\": 123, \"karma\": 10}]"; yieldMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(yieldMessage.getCode()).isEqualTo(70); assertThat(yieldMessage.getRequestId()).isEqualTo(6131533L); assertThat(yieldMessage.getArguments()).isEmpty(); assertThat(yieldMessage.getArgumentsKw()) .containsOnly(MapEntry.entry("userid", 123), MapEntry.entry("karma", 10)); json = "[70, 6131533, {}, [\"a\",\"b\",\"c\"], {\"userid\": 123, \"karma\": 10}]"; yieldMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(yieldMessage.getCode()).isEqualTo(70); assertThat(yieldMessage.getRequestId()).isEqualTo(6131533L); assertThat(yieldMessage.getArguments()).containsExactly("a", "b", "c"); assertThat(yieldMessage.getArgumentsKw()) .containsOnly(MapEntry.entry("userid", 123), MapEntry.entry("karma", 10)); }
public static YieldMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); jp.nextToken(); ParserUtil.readObject(jp); List<Object> arguments = null; JsonToken token = jp.nextToken(); if (token == JsonToken.START_ARRAY) { arguments = ParserUtil.readArray(jp); } Map<String, Object> argumentsKw = null; token = jp.nextToken(); if (token == JsonToken.START_OBJECT) { argumentsKw = ParserUtil.readObject(jp); } return new YieldMessage(request, arguments, argumentsKw); }
YieldMessage extends WampMessage { public static YieldMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); jp.nextToken(); ParserUtil.readObject(jp); List<Object> arguments = null; JsonToken token = jp.nextToken(); if (token == JsonToken.START_ARRAY) { arguments = ParserUtil.readArray(jp); } Map<String, Object> argumentsKw = null; token = jp.nextToken(); if (token == JsonToken.START_OBJECT) { argumentsKw = ParserUtil.readObject(jp); } return new YieldMessage(request, arguments, argumentsKw); } }
YieldMessage extends WampMessage { public static YieldMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); jp.nextToken(); ParserUtil.readObject(jp); List<Object> arguments = null; JsonToken token = jp.nextToken(); if (token == JsonToken.START_ARRAY) { arguments = ParserUtil.readArray(jp); } Map<String, Object> argumentsKw = null; token = jp.nextToken(); if (token == JsonToken.START_OBJECT) { argumentsKw = ParserUtil.readObject(jp); } return new YieldMessage(request, arguments, argumentsKw); } YieldMessage(long requestId, @Nullable List<Object> arguments,
			@Nullable Map<String, Object> argumentsKw); }
YieldMessage extends WampMessage { public static YieldMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); jp.nextToken(); ParserUtil.readObject(jp); List<Object> arguments = null; JsonToken token = jp.nextToken(); if (token == JsonToken.START_ARRAY) { arguments = ParserUtil.readArray(jp); } Map<String, Object> argumentsKw = null; token = jp.nextToken(); if (token == JsonToken.START_OBJECT) { argumentsKw = ParserUtil.readObject(jp); } return new YieldMessage(request, arguments, argumentsKw); } YieldMessage(long requestId, @Nullable List<Object> arguments,
			@Nullable Map<String, Object> argumentsKw); static YieldMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); @Nullable List<Object> getArguments(); @Nullable Map<String, Object> getArgumentsKw(); @Override String toString(); }
YieldMessage extends WampMessage { public static YieldMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); jp.nextToken(); ParserUtil.readObject(jp); List<Object> arguments = null; JsonToken token = jp.nextToken(); if (token == JsonToken.START_ARRAY) { arguments = ParserUtil.readArray(jp); } Map<String, Object> argumentsKw = null; token = jp.nextToken(); if (token == JsonToken.START_OBJECT) { argumentsKw = ParserUtil.readObject(jp); } return new YieldMessage(request, arguments, argumentsKw); } YieldMessage(long requestId, @Nullable List<Object> arguments,
			@Nullable Map<String, Object> argumentsKw); static YieldMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); @Nullable List<Object> getArguments(); @Nullable Map<String, Object> getArgumentsKw(); @Override String toString();  }