1

I am trying to migrate from Firebase 2.X to the latest version. Is there a way to continue using Jackson annotations? This will reduce the lift of my migration tremendously.

Example:

public final class Example {
    @JsonProperty("field_example")
    private int myField;

    Example() {

    }
}

gradle file

compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.fasterxml.jackson.core:jackson-core:2.8.6'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.6'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.6'
Daiwik Daarun
  • 3,804
  • 7
  • 33
  • 60
  • See http://stackoverflow.com/questions/37547399/how-to-deserialise-a-subclass-in-firebase-using-getvaluesubclass-class/37548330#37548330 – Frank van Puffelen Feb 04 '17 at 00:50
  • @FrankvanPuffelen "In the meantime you can use Jackson (which the Firebase 2.x SDKs used under the hood) to make the inheritance model work." I have the Jackson annotations set up but they do not appear to be working. Firebase complains about missing setters and getters – Daiwik Daarun Feb 04 '17 at 01:55
  • Without seeing the [minimum code that reproduces the problem](http://stackoverflow.com/help/mcve), it'll be hard to say anything more than in my answer in the link. – Frank van Puffelen Feb 04 '17 at 02:18
  • @FrankvanPuffelen I've added an example, thanks for looking into this – Daiwik Daarun Feb 04 '17 at 02:39

1 Answers1

0

If you're trying to rename the key where a particular JavaBean field gets stored, use the annotation @PropertyName("new_name") to override the standard JavaBean naming conventions. You can use this on either a member field (if public with no accessors) or the public accessor methods that get/set it.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441