I have in my code this if
if (method.getName().equals("ignore")) {
it's pointing to to a static method.
Can I somehow call getName on MyClass::ignore ??
I have in my code this if
if (method.getName().equals("ignore")) {
it's pointing to to a static method.
Can I somehow call getName on MyClass::ignore ??
No, there is no static (compile time) way to reference a method as a Method object. You'll have to dynamically retrieve it through Class#getMethod(..) (or other appropriate methods). Or use a String value for its name as you are currently doing.