I have a custom object named User, which is a RealmObject. This object also has annotations for Moshi because I plan on using this object in a retrofit call.
public class User extends RealmObject
{
@PrimaryKey private long id;
@Json(name = "email") private String email;
@Json(name = "first_name") private String firstName;
@Json(name = "last_name") private String lastName;
@Json(name = "password_hash") private String passwordHash;
@Json(name = "avatar") private String avatar;
@Json(name = "phone_number") private String phoneNumber;
@Json(name = "country") private String country;
@Json(name = "city") private String city;
@Json(name = "address") private String address;
@Json(name = "location") private Location location;
@Json(name = "zip") private String zip;
@Json(name = "device_meta") private DeviceMeta deviceMeta;
}
When I query my Realm DB for a user like this:
User user = getRealm().where(User.class).findFirst();
I get this response (using debugging):
As can be seen, the object isn't initialized but the values are showing in the first line.
What is the issue here?
When I pass the above object as a @Body parameter, it appears to be empty.
I've also checked via Fiddler and the request sent to the server contains an empty object.
Question: How do I get this object to get the proper values?