Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update existing object with json data #157

Open
krzysztof-miemiec opened this issue Apr 27, 2016 · 1 comment
Open

Update existing object with json data #157

krzysztof-miemiec opened this issue Apr 27, 2016 · 1 comment

Comments

@krzysztof-miemiec
Copy link

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().

@krzysztof-miemiec
Copy link
Author

See https://github.com/rs411/LoganSquare for implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant