Correct me again if my assumptions were incorrect, but you would do it as you normally would
static Class<?> clazz = MyIf.class;
public static void main(String[] args) throws Exception {
method(() -> System.out.println("hello")); // lambda
}
public static void method(MyIf myIf) {
System.out.println(clazz.isAssignableFrom(myIf.getClass()));
}
static interface MyIf {
public void execute();
}
prints
true
You don't actually ever get a reference to the lambda expression, the compiler generates a (synthetic?) class and an instance of it is passed to your method.