I'm using the last version at the moment of Firebase dependency, which is 1.0.2 and I'm having problems into getting my pojos parsed correctly.
The thing is, at any time the schema can changed but I don't want my app to crash with this:
D/AndroidRuntime(14097): Shutting down VM W/dalvikvm(14097): threadid=1: thread exiting with uncaught exception (group=0x40a451f8) E/AndroidRuntime(14097): FATAL EXCEPTION: main E/AndroidRuntime(14097): com.firebase.client.FirebaseException: Failed to bounce to type E/AndroidRuntime(14097): at com.firebase.client.DataSnapshot.getValue(DataSnapshot.java:213)
Looking into the dependency tree I get that Firebase is using Jackson mapper 1.9.7, so the annotation @JsonIgnoreProperties(ignoreUnknown = true")
is not an option. Moreover, the object mapper is wrapped into this Firebase object so I can't configure the DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES
property (DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES
for Jackson 1.9 and before).
Is there any way to set this property, either as a class-level annotation or configuring the mapper or any other mechanism whatsoever?
The best solution would be that Firebase 1.0.3 started using Jackson 2.0, but don't know if this is something they care about right now.
Note: I've already thought about excluding the transitive Jackson 1.9.7 dependency and adding Jackson 2.0 so that I can access to this ignoreUnknown feature, but I don't think it is a viable choice since I would be changing the mayor version.
public String getKey () Returns. The key name for the source location of this snapshot or null if this snapshot points to the database root.
If you need some value (or combination of values) to be unique, you need to create a node that contains that value (or combination) as its key. If you need to guarantee that multiple values (or combinations) are unique, you'll need multiple of such nodes.
So: yes, the items in an array field in a DocumentSnapshot that you read from Firestore are in the same order that you added them to the array.
The Push Method The push() method will create a unique id when the data is pushed.
For those who have moved over to Google's official version of Firebase (As of May 29, 2016), you can use @Exclude instead of @JsonIgnore or @JsonProperty. Here is the link to their document.
Example:
public class dataPacket{ public String data; ... @Exclude public String getData(){return data;} }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With