Currently there is no way to insert json data to an object that already exists.
It would be great to be able to do as below (use case for Realm):
@JsonObject
public class MyObject extends RealmObject {
@JsonField
@JsonObjectId
String id;
@JsonField
int someField;
@JsonField
String anotherField;
@OnJsonIdRead
MyObject onJsonIdRead(String id){
return MyRealmManager.getRealm().where(MyObject.class).equalTo("id", id).findFirst();
}
}
It would solve a problem with server returning different versions of json i.e. we already have id and anotherField, but in some call server returns only id and someField. Realm can't help with it's createOrUpdateAllFromJson().
Currently there is no way to insert json data to an object that already exists.
It would be great to be able to do as below (use case for Realm):
It would solve a problem with server returning different versions of json i.e. we already have
id
andanotherField
, but in some call server returns onlyid
andsomeField
. Realm can't help with it'screateOrUpdateAllFromJson()
.