Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Framework-wide fluent setters?
Hi,
Has there been any considerations regarding making all setters fluent (return this;)? Returning void in java is a bit of a waste since you don't have to do any assignments.
in a grid setup I can do
getColumn("info").setHeaderCaption(i18n("headers.info")).setExpandRatio(3).setSortable(false).setEditorField(new TextArea());
but if I want to set the null representation of the editor, I can no longer use
getColumn("info").setHeaderCaption(i18n("headers.info")).setExpandRatio(3).setSortable(false).setEditorField(new TextArea().setNullRepresentation(""));
The feature was considered for Vaadin 7 but dropped as nobody could figure out how to deal with inheritance properly. For instance AbstractComponent has a setter for "caption", which then would return AbstractComponent. Then you wouldn't be able to do
new Button().setCaption("Hello").addClickListener(...)
as AbstractComponent does not contain "addClickListener", which is quite strange as you would be able to do it the other way around
new Button().addClickListener(...).setCaption("Hello")