Java Foo.class and the Scala class literal syntax classOf[Foo] return a reflective look at the class in question.
Is it possible, and it would be advisable, to provide something like .method/.field or methodOf[] / fieldOf[] to obtain comparable reflective access to methods and fields?
How would this be implemented in Java / Scala?
In the case of Java, I would suggest that this will require either a change in language (very unlikely) or some kind of magic with bytecode tools / AspectJ, while in Scala it is possible to implement it with an implicit conversion.
source share