You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be very useful if the builder mechanism provided a way to retrieve, from the built XXXConfig object, the Config (if any) that was passed to the builder's config(Config) method.
For an example, suppose we create MetricsConfigBlueprint that starts out like this:
The intendend approach was to allow definition of Optional<Config> config() method on prototype.
All the infrustructure code is there (the method is correctly generated on implementation), but due to some changes in the builder code (refactoring of getters, where it used to implement the prototype and now has dedicated getters), the feature got broken (and was not tested).
Solution: add a check when generating the package local Optional<Config> config() method on builder base, and if such a method is declared on prototype, generate it as public (and do not generated it during the usual processing of fields)
Environment Details
Problem Description
It would be very useful if the builder mechanism provided a way to retrieve, from the built
XXXConfig
object, theConfig
(if any) that was passed to the builder'sconfig(Config)
method.For an example, suppose we create
MetricsConfigBlueprint
that starts out like this:Tomas suggested these steps as a workaround which almost worked but exposed a small bug:
Add a method to the blueprint:
In the builder decorator method (run as
build()
executes):Write a custom method for the prototype that refers to the saved config instance:
Tomas provided this patch that allows this approach to work:
The text was updated successfully, but these errors were encountered: