0

I have the following structure, for example:

public class Entity {
   private String name;
   ...
   public String getName() {
      return name;
   }
   public void setName(String name) {
      this.name = name;
   }
}

public class Person extends Entity {
   ...
}

I have upgraded the Firebase SDK from the old one (before Google buying it) and now I can only obtain the values from the fields declared in that class. Anything that is in a super class can't be accessible.

Every time I use the following code to fetch a Person object, it doesn't get the fields declared in Entity.

dataSnapshot.getValue(Person.class);

ClassMapper: No setter/field for name found on class com.package.Person

I don't want to write every getter and setter in every inner class, that doesn't make any sense. There's got to be a better (and cleaner) way!

Sergio Carneiro
  • 3,726
  • 4
  • 35
  • 51

1 Answers1

0

You need to set getter on yout child class.

public class Person extends Entity {
    getName(){return this.name;}
}
Prakkmak
  • 1
  • 2
  • 1
    The thing is, in the real context I have 7 fields inherited from Entity. And 5 classes that extends it. So it will be a mess to create getters/setters for all – Sergio Carneiro Jun 23 '16 at 12:11