Closed bryanstern closed 5 years ago
Incorporated your feedback. I totally agree we should infer the static builder()
methods where we can and be less picky about build
vs create
.
Any updates on this? I'm using @AutoValue.Builder and providing default/initial values on the builder, e.g. empty Guava Immutable collections.
@liujoshua still blocked on the AutoValue project. https://github.com/google/auto/pull/501
Closing this in favor of #224
This is a first pass at implementing a solution for #132 using the proposed AutoValue builder properties google/auto#501.
If an AutoValue class specifies a builder with the
@AutoValue.Builder
annotation, the generatedTypeAdapter#read
implementation will make use of the builder. If the builder performs any normalization or validation, it will run.The TypeAdapter default setters have been removed as builders allow the user to specify defaults using the AutoValue convention. Annotate the
builder()
method with@GsonDefaultBuilder
to specify which method AutoValueGson should use to get an instance of the builder.If your builder specifies multiple
build()
or unconventional build methods (not namedbuild
), you indicate which method in the Builder should be used with@GsonBuild
.