We use Java beans on some projects where I work, this means a lot of handcrafted boilerplate code like this.
I'm after an Eclipse plugin, or a way of configuring Eclipse code templates that allows a developer to generate the setters from a simple skeleton class, in a similar fashion to the 'Generate Getters and Setters' does for POJOs.
Input
public class MyBean {
private String value;
}
Expected output
public class MyBean {
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
private String value;
public String getValue() {
return this.value;
}
public void setValue(String newValue) {
String oldValue = this.value;
this.value = newValue;
this.pcs.firePropertyChange("value", oldValue, newValue);
}
[...]
}
I'm aware of project Lombok, but I'd prefer to stick to a pure Java/Eclipse based approach.
I'm considering writing an Eclipse plugin for this myself, what would be really useful is a more powerful template plugin in Eclipse, that could solve this problem and others.