@Test void encodesSet() { Set<Object> input = new LinkedHashSet<>(); input.add("foo"); input.add("bar"); Transcoder.EncodedValue output = JSON_TRANSCODER.encode(input); assertEquals("[\"foo\",\"bar\"]", new String(output.encoded(), StandardCharsets.UTF_8)); }
@Override public EncodedValue encode(final Object input) { if (input instanceof CommonOptions.BuiltCommonOptions || input instanceof CommonOptions) { throw InvalidArgumentException.fromMessage("No content provided, cannot " + "encode " + input.getClass().getSimpleName() + " as content!"); } if (input instanceof byte[]) { throw InvalidArgumentException.fromMessage("byte[] input is not supported for the JsonTranscoder!. " + "If you want to store already encoded JSON, use the RawJsonTranscoder, otherwise store it " + "with the RawBinaryTranscoder!"); } return new EncodedValue(serializer.serialize(input), CodecFlags.JSON_COMPAT_FLAGS); }
JsonTranscoder implements Transcoder { @Override public EncodedValue encode(final Object input) { if (input instanceof CommonOptions.BuiltCommonOptions || input instanceof CommonOptions) { throw InvalidArgumentException.fromMessage("No content provided, cannot " + "encode " + input.getClass().getSimpleName() + " as content!"); } if (input instanceof byte[]) { throw InvalidArgumentException.fromMessage("byte[] input is not supported for the JsonTranscoder!. " + "If you want to store already encoded JSON, use the RawJsonTranscoder, otherwise store it " + "with the RawBinaryTranscoder!"); } return new EncodedValue(serializer.serialize(input), CodecFlags.JSON_COMPAT_FLAGS); } }
JsonTranscoder implements Transcoder { @Override public EncodedValue encode(final Object input) { if (input instanceof CommonOptions.BuiltCommonOptions || input instanceof CommonOptions) { throw InvalidArgumentException.fromMessage("No content provided, cannot " + "encode " + input.getClass().getSimpleName() + " as content!"); } if (input instanceof byte[]) { throw InvalidArgumentException.fromMessage("byte[] input is not supported for the JsonTranscoder!. " + "If you want to store already encoded JSON, use the RawJsonTranscoder, otherwise store it " + "with the RawBinaryTranscoder!"); } return new EncodedValue(serializer.serialize(input), CodecFlags.JSON_COMPAT_FLAGS); } private  JsonTranscoder(final JsonSerializer serializer); }
JsonTranscoder implements Transcoder { @Override public EncodedValue encode(final Object input) { if (input instanceof CommonOptions.BuiltCommonOptions || input instanceof CommonOptions) { throw InvalidArgumentException.fromMessage("No content provided, cannot " + "encode " + input.getClass().getSimpleName() + " as content!"); } if (input instanceof byte[]) { throw InvalidArgumentException.fromMessage("byte[] input is not supported for the JsonTranscoder!. " + "If you want to store already encoded JSON, use the RawJsonTranscoder, otherwise store it " + "with the RawBinaryTranscoder!"); } return new EncodedValue(serializer.serialize(input), CodecFlags.JSON_COMPAT_FLAGS); } 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 EncodedValue encode(final Object input) { if (input instanceof CommonOptions.BuiltCommonOptions || input instanceof CommonOptions) { throw InvalidArgumentException.fromMessage("No content provided, cannot " + "encode " + input.getClass().getSimpleName() + " as content!"); } if (input instanceof byte[]) { throw InvalidArgumentException.fromMessage("byte[] input is not supported for the JsonTranscoder!. " + "If you want to store already encoded JSON, use the RawJsonTranscoder, otherwise store it " + "with the RawBinaryTranscoder!"); } return new EncodedValue(serializer.serialize(input), CodecFlags.JSON_COMPAT_FLAGS); } 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);  }