@Test public void deserializeTest() throws IOException { String json = "[48, 7814135, {}, \"com.myapp.ping\"]"; CallMessage callMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(callMessage.getCode()).isEqualTo(48); assertThat(callMessage.getRequestId()).isEqualTo(7814135L); assertThat(callMessage.getProcedure()).isEqualTo("com.myapp.ping"); assertThat(callMessage.isDiscloseMe()).isFalse(); assertThat(callMessage.getArguments()).isNull(); assertThat(callMessage.getArgumentsKw()).isNull(); json = " [48, 7814135, {}, \"com.myapp.echo\", [\"Hello, world!\"]]"; callMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(callMessage.getCode()).isEqualTo(48); assertThat(callMessage.getRequestId()).isEqualTo(7814135L); assertThat(callMessage.getProcedure()).isEqualTo("com.myapp.echo"); assertThat(callMessage.isDiscloseMe()).isFalse(); assertThat(callMessage.getArguments()).containsExactly("Hello, world!"); assertThat(callMessage.getArgumentsKw()).isNull(); json = "[48, 7814135, {}, \"com.myapp.add2\", [23, 7]]"; callMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(callMessage.getCode()).isEqualTo(48); assertThat(callMessage.getRequestId()).isEqualTo(7814135L); assertThat(callMessage.getProcedure()).isEqualTo("com.myapp.add2"); assertThat(callMessage.isDiscloseMe()).isFalse(); assertThat(callMessage.getArguments()).containsExactly(23, 7); assertThat(callMessage.getArgumentsKw()).isNull(); json = "[48, 7814135, {}, \"com.myapp.user.new\", [\"johnny\"],{\"firstname\": \"John\", \"surname\": \"Doe\"}]"; callMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(callMessage.getCode()).isEqualTo(48); assertThat(callMessage.getRequestId()).isEqualTo(7814135L); assertThat(callMessage.getProcedure()).isEqualTo("com.myapp.user.new"); assertThat(callMessage.isDiscloseMe()).isFalse(); assertThat(callMessage.getArguments()).containsExactly("johnny"); assertThat(callMessage.getArgumentsKw()).containsExactly( MapEntry.entry("firstname", "John"), MapEntry.entry("surname", "Doe")); json = "[48, 7814135, {\"disclose_me\":true}, \"com.myapp.add2\", [23, 7]]"; callMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(callMessage.getCode()).isEqualTo(48); assertThat(callMessage.getRequestId()).isEqualTo(7814135L); assertThat(callMessage.getProcedure()).isEqualTo("com.myapp.add2"); assertThat(callMessage.isDiscloseMe()).isTrue(); assertThat(callMessage.getArguments()).containsExactly(23, 7); assertThat(callMessage.getArgumentsKw()).isNull(); }
public static CallMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); boolean discloseMe = false; jp.nextToken(); Map<String, Object> options = ParserUtil.readObject(jp); if (options != null) { discloseMe = (boolean) options.getOrDefault("disclose_me", false); } jp.nextToken(); String procedure = jp.getValueAsString(); 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 CallMessage(request, procedure, arguments, argumentsKw, discloseMe); }
CallMessage extends WampMessage { public static CallMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); boolean discloseMe = false; jp.nextToken(); Map<String, Object> options = ParserUtil.readObject(jp); if (options != null) { discloseMe = (boolean) options.getOrDefault("disclose_me", false); } jp.nextToken(); String procedure = jp.getValueAsString(); 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 CallMessage(request, procedure, arguments, argumentsKw, discloseMe); } }
CallMessage extends WampMessage { public static CallMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); boolean discloseMe = false; jp.nextToken(); Map<String, Object> options = ParserUtil.readObject(jp); if (options != null) { discloseMe = (boolean) options.getOrDefault("disclose_me", false); } jp.nextToken(); String procedure = jp.getValueAsString(); 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 CallMessage(request, procedure, arguments, argumentsKw, discloseMe); } CallMessage(long request, String procedure);  CallMessage(long request, String procedure, @Nullable List<Object> arguments);  CallMessage(long request, String procedure,
			@Nullable Map<String, Object> argumentsKw);  CallMessage(long requestId, String procedure, @Nullable List<Object> arguments,
			@Nullable Map<String, Object> argumentsKw, boolean discloseMe); }
CallMessage extends WampMessage { public static CallMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); boolean discloseMe = false; jp.nextToken(); Map<String, Object> options = ParserUtil.readObject(jp); if (options != null) { discloseMe = (boolean) options.getOrDefault("disclose_me", false); } jp.nextToken(); String procedure = jp.getValueAsString(); 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 CallMessage(request, procedure, arguments, argumentsKw, discloseMe); } CallMessage(long request, String procedure);  CallMessage(long request, String procedure, @Nullable List<Object> arguments);  CallMessage(long request, String procedure,
			@Nullable Map<String, Object> argumentsKw);  CallMessage(long requestId, String procedure, @Nullable List<Object> arguments,
			@Nullable Map<String, Object> argumentsKw, boolean discloseMe); static CallMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); String getProcedure(); @Nullable List<Object> getArguments(); @Nullable Map<String, Object> getArgumentsKw(); boolean isDiscloseMe(); @Override String toString(); }
CallMessage extends WampMessage { public static CallMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); boolean discloseMe = false; jp.nextToken(); Map<String, Object> options = ParserUtil.readObject(jp); if (options != null) { discloseMe = (boolean) options.getOrDefault("disclose_me", false); } jp.nextToken(); String procedure = jp.getValueAsString(); 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 CallMessage(request, procedure, arguments, argumentsKw, discloseMe); } CallMessage(long request, String procedure);  CallMessage(long request, String procedure, @Nullable List<Object> arguments);  CallMessage(long request, String procedure,
			@Nullable Map<String, Object> argumentsKw);  CallMessage(long requestId, String procedure, @Nullable List<Object> arguments,
			@Nullable Map<String, Object> argumentsKw, boolean discloseMe); static CallMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); String getProcedure(); @Nullable List<Object> getArguments(); @Nullable Map<String, Object> getArgumentsKw(); boolean isDiscloseMe(); @Override String toString(); static final int CODE; }