Is it possible to programatically read class and static method name referred by lambda? For example:
public class Testing {
interface Generic { void call(); }
static public void method1() {
System.out.println("In method1");
}
static public void method2() {
System.out.println("In method2");
}
public void test() {
Generic g1 = () -> Testing.method1();
Generic g2 = () -> Testing.method2();
g1.call();
g2.call();
// System.out.println("g1 -> " + getLambdaReference(g1))
}
I would like to somehow read that g1
is pointing to Testing.method1
and g2
is pointing to Test.method2
.