Closed tandraschko closed 8 months ago
A RecordELResolver
that sit just before (or just after - I don't think it matters) the BeanELResolver
in the default ELResolver
seems reasonable.
How do you see write-access working given that Records are intended to be read-only?
Sounds good
In theory we could clone it to simulate a write, but thats kinda complex/magic
for now we could just throw a exception when trying to write via the ELResolver
We can handle attempts to write to a Record
the same way we handle attempts to write to a read-only Bean property.
I will note that this means increasing the minimum Java version from 11 to 14 which really means 17 if we want a LTS version. That has a knock-on impact on the Pages API. I don't think either of those is a show-stopper. Just mentioning so everyone is aware and can speak up if they see any issues.
+1
Jakarta EE 11 will be Java 21+ and will include Jakarta Persistence 3.2 which has support for java records
https://jakarta.ee/specifications/persistence/3.2/
... Did someone forgot to align the specs with the "web" tier?
@markt-asf can we add this readonly resolver for EE11?
It is on the TODO list.
In theory we could clone it to simulate a write, but thats kinda complex/magic
I think it is possible, create a new record instance using the value in the view/request.
Records are reads-only. If you want read/write, use a bean.
I have a draft implementation of this. I'll provide a PR shortly.
+1 @markt-asf
I'll leave the PR (#204) for at least a week for folks to review before thinking about merging.
Thanks!
As reference: https://github.com/jakartaee/faces/issues/1820
Currently records are not supported in read-access, nor write-access.
I think read-access can be easily added but what about write?