Hello @core-libs-dev <[email protected]>,

Let's say I have a record User(String first, String last) {}. That code
grants me User::first and User::last as accessor methods. Very cool.

I can access those accessor methods if I am given the class. It is a
trivial call from User.class ---> Class.getRecordComponents() --->
RecordComponent.getAccessor() ---> Method.invoke() ---> User::first/last.
It is very powerful.

But this only lets me go top-down. If I want to take a record accessor like
User::first and turn that into a record component, then that is not
something I can see how to do.

Is it impossible? There is a lot of value in being able to look at a method
reference and be able to see that class that that method being referenced
is contained within. For example, I would like to be able to look at
User::first, and be able to get the accompanying RecordComponent. And if
not that, then at least the accompanying java.lang.reflect.Method. Is that
possible?

Thank you for your time and consideration.
David Alayachew

Reply via email to