Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Grid] Support Java records in GridEditor #6785

Open
vursen opened this issue Nov 4, 2024 · 0 comments
Open

[Grid] Support Java records in GridEditor #6785

vursen opened this issue Nov 4, 2024 · 0 comments
Labels
enhancement New feature or request vaadin-grid

Comments

@vursen
Copy link
Contributor

vursen commented Nov 4, 2024

Describe your motivation

Starting from 24.5, Binder officially supports Java records. However, GridEditor needs an update before developers can use them smoothly.

Since records are immutable by design, they seem to make sense primarily in buffered mode, which was originally designed to prevent changes to beans until save() is explicitly called. Using records in buffered mode today leads to exceptions when calling save() because it uses Binder API that's incompatible with records.

Describe the solution you'd like

  • Update buffered mode to work with Java records
  • Add a note in the setBuffered() JavaDoc recommending buffered mode for records

Furthermore, editItem(T item) could throw an exception requiring to enable buffered mode if item is a record. However, there is evidence that some applications are already using records in non-buffered mode with custom workarounds. The exception will break them forcing developers to rewrite potentially a significant part of the code.

Additional context

#6755 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vaadin-grid
Projects
None yet
Development

No branches or pull requests

2 participants