nhachicha / SnappyDB

A key-value database for Android
1.78k stars 220 forks source link

How can I save and get a object like this. #62

Open liangpengfei opened 9 years ago

liangpengfei commented 9 years ago

My Object is like that:

public class User implements Serializable{
    private static final long serialVersionUID = 5067708798089701226L;
    private String name;
    private Address address;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Address getAddress() {
        return address;
    }
    public void setAddress(Address address) {
    this.address = address;
    }
}

and the Address object is like that:

public class Address implements Serializable {
    private static final long serialVersionUID = 5984117680919142898L;
    private String address1;
    private String address2;
    public Address(String address1, String address2) {
        this.address1 = address1;
        this.address2 = address2;
    }
    public String getAddress1() {
        return address1;
    }
    public void setAddress1(String address1) {
        this.address1 = address1;
    }
    public String getAddress2() {
        return address2;
    }
    public void setAddress2(String address2) {
        this.address2 = address2;
    }
}

But I can't get my object when I want to use it , I use getObject() ,but can't get anything . Is there anyone else meet this problem?