Loading...
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.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Framework-wide fluent setters?

Nicklas Karlsson
6 years ago Dec 23, 2015 8:08am
Artur Signell
6 years ago Dec 26, 2015 12:09pm

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")