@Test void decodesJsonObject() { byte[] input = "{\"foo\":\"bar\"}".getBytes(StandardCharsets.UTF_8); JsonObject decoded = JSON_TRANSCODER.decode(JsonObject.class, input, CodecFlags.JSON_COMPAT_FLAGS); assertEquals(JsonObject.fromJson(input), decoded); }
@Override public <T> T decode(final Class<T> target, final byte[] input, int flags) { if (target.isAssignableFrom(byte[].class)) { throw InvalidArgumentException.fromMessage("byte[] input is not supported for the JsonTranscoder!. " + "If you want to read already encoded JSON, use the RawJsonTranscoder, otherwise read it " + "with the RawBinaryTranscoder!"); } return serializer.deserialize(target, input); }
JsonTranscoder implements Transcoder { @Override public <T> T decode(final Class<T> target, final byte[] input, int flags) { if (target.isAssignableFrom(byte[].class)) { throw InvalidArgumentException.fromMessage("byte[] input is not supported for the JsonTranscoder!. " + "If you want to read already encoded JSON, use the RawJsonTranscoder, otherwise read it " + "with the RawBinaryTranscoder!"); } return serializer.deserialize(target, input); } }
JsonTranscoder implements Transcoder { @Override public <T> T decode(final Class<T> target, final byte[] input, int flags) { if (target.isAssignableFrom(byte[].class)) { throw InvalidArgumentException.fromMessage("byte[] input is not supported for the JsonTranscoder!. " + "If you want to read already encoded JSON, use the RawJsonTranscoder, otherwise read it " + "with the RawBinaryTranscoder!"); } return serializer.deserialize(target, input); } private  JsonTranscoder(final JsonSerializer serializer); }
JsonTranscoder implements Transcoder { @Override public <T> T decode(final Class<T> target, final byte[] input, int flags) { if (target.isAssignableFrom(byte[].class)) { throw InvalidArgumentException.fromMessage("byte[] input is not supported for the JsonTranscoder!. " + "If you want to read already encoded JSON, use the RawJsonTranscoder, otherwise read it " + "with the RawBinaryTranscoder!"); } return serializer.deserialize(target, input); } private  JsonTranscoder(final JsonSerializer serializer); static JsonTranscoder create(JsonSerializer serializer); @Override EncodedValue encode(final Object input); @Override T decode(final Class<T> target, final byte[] input, int flags); @Override T decode(TypeRef<T> target, byte[] input, int flags); }
JsonTranscoder implements Transcoder { @Override public <T> T decode(final Class<T> target, final byte[] input, int flags) { if (target.isAssignableFrom(byte[].class)) { throw InvalidArgumentException.fromMessage("byte[] input is not supported for the JsonTranscoder!. " + "If you want to read already encoded JSON, use the RawJsonTranscoder, otherwise read it " + "with the RawBinaryTranscoder!"); } return serializer.deserialize(target, input); } private  JsonTranscoder(final JsonSerializer serializer); static JsonTranscoder create(JsonSerializer serializer); @Override EncodedValue encode(final Object input); @Override T decode(final Class<T> target, final byte[] input, int flags); @Override T decode(TypeRef<T> target, byte[] input, int flags);  }