0

Have had a very old version of Auto Value Gson (0.4.4alpha) from Ryan Harter. Now we want to migrate to something more current (1.0.0). However, something that is missing for me are the default values of the properties when deserializing - I used to be able to do something like

public static TypeAdapter<Highlighted> typeAdapter(Gson gson) {
      return new AutoValue_MyObjects.GsonTypeAdapter(gson)
                     .setDefaultOptions(new ArrayList<>());
}

And now the default methods do not seem to be supported any longer. Any ideas how I can achieve what I used to have in the newer version?

Boris Strandjev
  • 46,145
  • 15
  • 108
  • 135
  • did you able to solve it? i am struggling with the same problem – Efi G Jun 18 '19 at 11:26
  • 1
    It turned out this default thing was never part of the original library, it was patched and served in my company's artifactory. Not contributed back to the open source. I have always said this is stupid thing to do and now history teaches us once again never to do that. Now being forced to merge between two distinct branches I just gave up – Boris Strandjev Jun 18 '19 at 16:30
  • 1
    i ended up writing my own type adapter that used the auto_value builder instead of the constructor, thus allowing to get the default values from the builder. – Efi G Jun 19 '19 at 15:54

0 Answers0