rharter / auto-value-gson

AutoValue Extension to add Gson De/Serializer support
Apache License 2.0
607 stars 103 forks source link

support default value for generated type adapter #218

Closed efraimg closed 5 years ago

efraimg commented 5 years ago

I would like to add a none nullable new field so will be helpful to be able to set a default value in the deserializer. I see that in older versions it was available but can't see it on 1.0.0. Is it possible to achieve this somehow?

ZacSweers commented 5 years ago

We removed it and feel it's something that should be handled via #136, but requires support from autovalue

efraimg commented 5 years ago

Thank you:)

otto-dev commented 5 years ago

For anyone else looking, this has been implemented in #224.Update to 1.1.x

If an AutoValue class specifies a builder with the @AutoValue.Builder annotation, the generated TypeAdapter#read implementation will make use of the builder.