i need a little help. I got the following two classes and if i want to push an Object with the the code below, it only pushes the object variables from the Super Class(Group). So i get these Data:
How can i push the other variables too ?
PrivateGroup pg = new PrivateGroup(username,groupName,description,state,city, password);
pg.getMembers().add(username);
reference.child("groups").child("private").push().setValue(pg);
Group.class
@IgnoreExtraProperties
public class Group implements Serializable {
private String owner;
private String name;
private String description;
private List<String> members;
public Group() {
}
public Group(String owner, String name, String description) {
this.owner = owner;
this.name = name;
this.description = description;
this.members = new ArrayList<String>();
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<String> getMembers() {
return members;
}
public void setMembers(List<String> members) {
this.members = members;
}
@Override
public String toString() {
return " Group{" +
"owner='" + owner + '\'' +
", name='" + name + '\'' +
", description='" + description + '\'' +
", members='" + members + '\'' +
'}';
}
}
And PrivateGroup.class
@IgnoreExtraProperties
public class PrivateGroup extends Group implements Serializable {
private String state;
private String city;
private String password;
public PrivateGroup() {
}
public PrivateGroup(String owner, String name, String description, String state, String city, String password) {
super(owner,name, description);
this.state = state;
this.city = city;
this.password = password;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "PrivateGroup{" +
"owner='" + this.getOwner() + '\'' +
", name='" + this.getName() + '\'' +
", description='" + this.getDescription() + '\'' +
", state='" + state + '\'' +
", city='" + city + '\'' +
", password='" + password + '\'' +
", members='" + this.getMembers() + '\'' +
'}';
}
}