First off props to @rs411.
How to use this? If you just c&p this as @peterbetos pointed out you get a
TypeConverter classes must have a non-private zero argument constructor.
How to solve this?
As I am using this for diffent types like lets say RealmList<UserEntity>
. I did the following:
/**
* Created by meier on 26.08.16.
*/
public class UserEntityRealmListConverter extends RealmListConverter {
public UserEntityRealmListConverter() {
super(UserEntity.class);
}
}
I basically did this for every Type and my RealmObject
's look like this:
@JsonObject @Getter public class UserEntityList extends RealmObject {
@JsonField(name = "random") int randomValue;
/// [...]
@JsonField(name = "userList", typeConverter = UserEntityRealmListConverter.class) RealmList<UserEntity>
realmUserList;
}