Automatically create builder for class in Eclipse
Solution 1:
You may want to look at lombok annotations to generate builders without the boiler plate code. For example:
@Builder
public class MyPojo {
private String name;
}
MyPojoBuilder.builder().name("yourame").build();
The limitation is that this doesn't seem to work with abstract classes.
Solution 2:
Maybe I am late to the party.
Eclipse on its own does not provide a way to generate code to support builder pattern. However it can be extended through plugins to enhance the functionality.
There is this plugin that I use this:
https://github.com/henningjensen/bpep
Edit: After 5 years, revisiting this topic, would recommend to use lombok that has become industry standard anyway and is also IDE agnostic ==> would work if your team mates use a variety of IDEs.
Solution 3:
I currently use Spark Builder Generator with Eclipse Neon.1a Release (4.6.1) and it works well.
- https://marketplace.eclipse.org/content/sparkbuildergenerator
- https://github.com/helospark/SparkBuilderGenerator
You can set the preferences under:
Window->Preferences->Java->Spark Builder Generator