JsonCodec { public static <T> JsonCodec<List<T>> listJsonCodec(Class<T> type) { requireNonNull(type, "type is null"); Type listType = new TypeToken<List<T>>() {} .where(new TypeParameter<T>() {}, type) .getType(); return new JsonCodec<>(OBJECT_MAPPER_SUPPLIER.get(), listType); } JsonCodec(ObjectMapper mapper, Type type); static JsonCodec<T> jsonCodec(Class<T> type); static JsonCodec<T> jsonCodec(TypeToken<T> type); static JsonCodec<List<T>> listJsonCodec(Class<T> type); static JsonCodec<List<T>> listJsonCodec(JsonCodec<T> type); static JsonCodec<Map<K, V>> mapJsonCodec(Class<K> keyType, Class<V> valueType); static JsonCodec<Map<K, V>> mapJsonCodec(Class<K> keyType, JsonCodec<V> valueType); JsonCodec<T> withoutPretty(); Type getType(); T fromJson(String json); String toJson(T instance); Optional<String> toJsonWithLengthLimit(T instance, int lengthLimit); T fromJson(byte[] json); byte[] toJsonBytes(T instance);  }
@Test public void testListJsonCodec() { JsonCodec<List<Person>> jsonCodec = listJsonCodec(Person.class); Person.validatePersonListJsonCodec(jsonCodec); }
@Test public void testImmutableListJsonCodec() { JsonCodec<List<ImmutablePerson>> jsonCodec = listJsonCodec(ImmutablePerson.class); ImmutablePerson.validatePersonListJsonCodec(jsonCodec); }