Open markhobson opened 9 years ago
Java currently has no official mechanism of obtaining the method name from a method reference. I'm aware of two possible workarounds:
hasFeature
(making this method less convenient) or be obtained in a non-portable way from the bytecode by using a library such as TypeTools.Neither of these approaches seem suitable but I'm open to ideas.
Remaining task is to derive a friendly name from the method name, e.g. first name
from getFirstName
.
When using
ComposeMatchers.hasFeature(Function, Matcher)
the feature name defaults to the string representation of the supplied function. For method references this results in something unwieldy like the following:Ideally we would infer the method name from the method reference and use that instead. Furthermore we could translate method names to English property names, e.g.
getFirstName
tofirst name
.