Improving Method Reference Ergonomics
Peter Eastham
petereastham at gmail.com
Mon Dec 9 15:46:04 UTC 2024
Hey Remi,
My usage of JPA was more for a common point of reference, as I figured most
Java Developers who would subscribe to Amber would have interacted with it
at one point or another. Not necessarily my personal use case, nor current
need.
I did another review of the Static Meta-Model this morning. I agree it
accomplishes the same scope as what I would like with the Method Reference
Improvements, however it isn't an option the moment we stop dealing within
JPA.
I'll review Ethan's links and write a more full overview which I'll post to
the Babylon Project's list before the end of the year. (Assuming I don't
get too distracted with the Class File Api)
Thanks everyone,
-Peter
On Mon, Dec 9, 2024 at 8:35 AM Remi Forax <forax at univ-mlv.fr> wrote:
> Hello
> are you aware of Jakarta data API ?
> https://github.com/jakartaee/data
>
> Which is quite similar to Spring Data and provide a typesafe API,
> here is a presentation by Gavin King
> https://www.youtube.com/watch?v=X9GplCb5SWY
>
> For me the static meta-model does exactly what you want.
>
> regards,
> Rémi
>
> ------------------------------
>
> *From: *"Peter Eastham" <petereastham at gmail.com>
> *To: *"amber-dev" <amber-dev at openjdk.org>
> *Sent: *Monday, December 9, 2024 2:52:32 AM
> *Subject: *Improving Method Reference Ergonomics
>
> Hi Amber team,
>
> Earlier this week I was playing around with fluent API design, and I
> believe Java could benefit from some improvements to the usage of Method
> References, I'll keep this short with the following example.
>
> Lets take the following JPA Criteria from section 6.3.3 of the
> Specification, (Only for an example of what an API could begin doing, not
> should do)
> CriteriaQuery q = cb.createQuery(Customer.class);
> Root customer = q.from(Customer.class);
> Join order = customer.join(Customer_.orders, JoinType.LEFT);
> q.where(cb.equal(customer.get(Customer_.status), 1)).select(customer);
>
> If there was greater access to the Method Reference more implicit
> information could be passed, reducing the noise,
> CriteriaQuery q = CriteriaQuery.createQuery(Customer::new)
> .leftJoin(Customer::orders)
> .where(Object::equals, Customer::status, 1);
> var result = q.select();
>
> Regarding what should be available, the resolved Class and Method name at
> least, anything else I'd leave up to the feasibility of the change.
>
> Thanks,
> -Peter
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20241209/45c387f5/attachment-0001.htm>
More information about the amber-dev
mailing list