[records] A reflection API to get the primary constructor?
Tagir Valeev
amaembo at gmail.com
Wed Sep 25 15:44:17 UTC 2019
Hello!
Speaking of the reflection API, do we have a way to get a primary
constructor of a record class? Sure we can do something like
cls.getConstructor(Arrays.stream(cls.getRecordAccessors()).map(Method::getReturnType).toArray())
But it looks like a bit verbose. Something like
cls.getPrimaryConstructor() (throwing on non-records) looks better.
What do you think?
With best regards,
Tagir Valeev.
More information about the amber-spec-experts
mailing list