我正在使用新的firebase sdk for android并使用真正的数据库功能.当我使用getValue(simple.class)一切都很好.但是当我想解析一个子类的类时,母类的所有属性都是null,并且我有这种类型的错误:
在类uk.edume.edumeapp.TestChild上找不到名称的setter/field
public class TestChild extends TestMother {
private String childAttribute;
public String getChildAttribute() {
return childAttribute;
}
}
public class TestMother {
protected String motherAttribute;
protected String getMotherAttribute() {
return motherAttribute;
}
}
Run Code Online (Sandbox Code Playgroud)
这个功能
snapshot.getValue(TestChild.class);
Run Code Online (Sandbox Code Playgroud)
motherAttribute属性是null,我得到
在类uk.edume.edumeapp.TestChild上找不到关于motherAttribute的setter/field
我解析的Json是:
{
"childAttribute" : "attribute in child class",
"motherAttribute" : "attribute in mother class"
}
Run Code Online (Sandbox Code Playgroud) java android jackson json-deserialization firebase-realtime-database
在Chrome DevTools(Chrome 59)的" 性能"面板的" 网络"部分中,每个请求都有一个行和条.例如,请看下面的屏幕截图.ados.js
这是时间分解ados.js.
这两个表示如何相互映射?
我有这样的用户类
public class User{
int id;
String description;
String shortDescription;
String photo;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getShortDescription() {
return shortDescription;
}
public void setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用 FirebaseRecyclerAdapter 获取存储在我的 …