.setData() gone?

Hi,

is there anything like the old generic .setData() in Component?
Or do I have to extend it and add by my own?

Thanks,
MZ

Hi Marco.

There is an alternative, but it is hidden in [ComponentUtil]
(https://vaadin.com/api/platform/13.0.11/com/vaadin/flow/component/ComponentUtil.html) class. You can store data to a component instance using either a String or Class as the key type with the setData and getData methods. Hopefully this helps.

The reason why it is hidden is that in previous framework versions, the Component.setData method was used a lot “for the wrong reasons” and it was also named quite oddly (what is data for a component ?). So now instead of exposing it in the Component API, we are kind of waiting for the actual use cases to surface and then ad the proper API ™ for those.

So can you please elaborate what is your particular use cases for storing data to a component on server side ?

Cheers,
Pekka

Pekka Hyvönen:
So can you please elaborate what is your particular use cases for storing data to a component on server side ?

setData is like that small coat hanger you can find in any toilet! :wink: