Firebase Android Class-based Updates Not Respecting Case Of The Field Names
I have the following class declared (note the case choice): public class User{ private String DisplayName; private Boolean Proxy = false; @SuppressWarnings('unused')
Solution 1:
You seem to assume that the names in the Firebase storage are based on your fields DisplayName
and Proxy
.
But if you read the documentation on setValue
it says:
The class must define public getters for the properties to be assigned. Properties without a public getter will be set to their default value when an instance is deserialized
This reads like Firebase uses the Java bean definition of properties (since Java doesn't have native properties), which means they are derived from the (public) method names getDisplayName
and getProxy
.
To determine the property name from getDisplayName
you strip the get
prefix and make the first letter after that lowercase. And that leads exactly to the property names you're seeing in your Firebase storage.
Post a Comment for "Firebase Android Class-based Updates Not Respecting Case Of The Field Names"