public class MyButton{
public MyButton(){}
public MyButton setIcon(Icon icon){return this;}
public MyButton setText(String text){return this;}
}
And used like:
MyButton testButton = new MyButton()
.setIcon(MyIcon)
.setText("MyText");
I know its not a true implementation of the builder pattern, but is there something inherently wrong with this design?
MyButton test = new MyButton(); test.setIcon(); test.setText();foo.withSomething(bar)to make a clear difference between traditional setters and fluent methods but that's really the only thing I have to say about the issue.