MelGrubb / BuilderGenerator

A source-generator-based implementation of the Builder pattern
https://melgrubb.github.io/BuilderGenerator/
MIT License
36 stars 8 forks source link

Moved WithObject to generated code, added FromTemplate #43

Closed MelGrubb closed 8 months ago

MelGrubb commented 8 months ago

Related to #42, but still a work in progress.

I've moved the WithObject method out from the base class and into the generated half of the builder. This means that it can return the concrete builder type instead of the generic base class. I also added a new FromTemplate method that lets you make a shallow clone of an example object. I'm not married to the name. FromExample would work well too, since "Template" might gert confusing if/when I'm able to add configurable templates back in.