In Scala/Java, how to inspect where a method is defined? -
for example, saw scala expression this:
objx.methody
there seems no way see methody
came from, may came from:
(1) class of objx
, let's call classx
(2) super class of objx
(classx
), let's call superclassx
(3) class called classz
, classz
irrelevant objx
, there implicit conversion classx
classz
.
so there may 3 possibilities source of methody
, have ideas how find out methody
defined?
in other words, in scala, how inspect information of method (especially method came implicit conversion) @ runtime?
there possibility class has method declared reflection. namings:
objx.getclass().getmethod("methody").getdeclaringclass();
Comments
Post a Comment