| Author |
Is there a way to find out if a Method is static via reflection?
|
Dan Bizman
Ranch Hand
Joined: Feb 25, 2003
Posts: 387
|
|
|
I have a java.lang.reflection.Method passed to my method and I need to generate some text describing it. How do i find out if it's a static method?
|
 |
Marco Ehrentreich
best scout
Bartender
Joined: Mar 07, 2007
Posts: 1221
|
|
Hi, in class "java.lang.reflect.Method" there's a method getModifiers(). This method returns an int which you can in turn check with the static methods of class "java.lang.reflect.Modifier". The isStatic(int modifiers) will tell you wether a method is static or not Marco
|
 |
 |
|
|
subject: Is there a way to find out if a Method is static via reflection?
|
|
|