相关疑难解决方法(0)

如何使用getValue(Subclass.class)反序列化Firebase中的子类

我正在使用新的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

14
推荐指数
2
解决办法
5434
查看次数

"性能"面板的"网络"部分中每个请求的行和条的含义是什么?

在Chrome DevTools(Chrome 59)的" 性能"面板的" 网络"部分中,每个请求都有一个行和条.例如,请看下面的屏幕截图.ados.js

表现小组

这是时间分解ados.js.

时间标签

这两个表示如何相互映射?

google-chrome-devtools

7
推荐指数
1
解决办法
690
查看次数

如何从android中的firebase获取对象?

我有这样的用户类

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 获取存储在我的 …

android firebase firebase-realtime-database

3
推荐指数
1
解决办法
594
查看次数