Как десериализовать подкласс в Firebase, используя getValue (Subclass.class)

Я использую новый Firebase SDK для Android и использую реальную функцию базы данных. Когда я используюgetValue(simple.class) Все отлично. Но когда я хочу проанализировать класс, который является подклассом, все атрибуты родительского классаnullи у меня есть этот тип ошибки:

Не найдено сеттера / поля для имени в классе uk.edume.edumeapp.TestChild

public class TestChild  extends TestMother {

    private String childAttribute;

    public String getChildAttribute() {
        return childAttribute;
    }
}

public class TestMother {

    protected String motherAttribute;

    protected String getMotherAttribute() {
        return motherAttribute;
    }
}

эта функция

snapshot.getValue(TestChild.class);

motherAttribute атрибутnullи я получаю

Не найдено сеттера / поля для motherAttribute в классе uk.edume.edumeapp.TestChild

Json, который я анализирую:

{
  "childAttribute" : "attribute in child class",
  "motherAttribute" : "attribute in mother class"
}

Ответы на вопрос(0)

Ваш ответ на вопрос