Код: Выделить всё
// class containing ImmutableMap
class Example {
private ImmutableMap;
}
// and an ImmutableList
ImmutableList
Код: Выделить всё
final Gson gson = new GsonBuilder()
.registerTypeAdapterFactory(ImmutableAdapterFactory.forJava())
.create();
final Type exampleListType = new TypeToken() {}.getType();
final List deserialized = gson.fromJson(
payload,
exampleListType
);
< /code>
Abstract classes can't be instantiated! Adjust the R8 configuration or register an
InstanceCreator or a TypeAdapter for this type. Class name: com.google.common.collect.ImmutableMap
< /code>
I can't change the property from ImmutableMapПодробнее здесь: https://stackoverflow.com/questions/796 ... using-gson