Functional builders in Java with Jilt
A few months ago, I shared an article about what I called Java functional builders, inspired by an equivalent pattern found in Go. The main idea was to have builders that looked like this example:
LanguageModel languageModel = new LanguageModel( name("cool-model"), project("my-project"), temperature(0.5), description("This is a generative model") ); Compared to the more tranditional builder approach:
You’re using the new keyword again to construct instances. There’s no more build() method, which felt a bit verbose.
Read more...