JSON flattening.

This is a new API that makes it possible to do more interesting things
with composition. It's currently write-only; doing composition on reads
is much more difficult.
This commit is contained in:
Jesse Wilson
2018-10-13 23:46:11 -04:00
parent 08bfedaeb2
commit f28bca609a
5 changed files with 477 additions and 4 deletions

View File

@@ -103,7 +103,7 @@ final class RuntimeJsonAdapterFactory<T> implements JsonAdapter.Factory {
return null;
}
List<JsonAdapter<Object>> jsonAdapters = new ArrayList<>();
List<JsonAdapter<Object>> jsonAdapters = new ArrayList<>(subtypes.size());
for (int i = 0, size = subtypes.size(); i < size; i++) {
jsonAdapters.add(moshi.adapter(subtypes.get(i)));
}