In Java, I have defined an interface MyInterfaceName [MyInterfaceName.class]. This .class file is available inside a jarFile.
Using Java Reflection, I am trying to use the method, class.isInterface()
in this particular class, but it returns false.
Again, based upon the following references,
http://tutorials.jenkov.com/java-reflection/classes.html#modifiers http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Modifier.html#isInterface(int)
I tried the following code:
int modifierValue = MyInterfaceName.class.getModifiers();
System.out.println(modifierValue)
boolean interfaceFound = Modifier.isInterface(modifierValue);
System.out.println(interfaceFound)
This interfaceFound
returns only false
. Also, modifierValue
returns 17
, which doesn't fit anywhere in the ModifierValueLink I have provided.
But MyInterfaceName is an interface defined according to java standards. I couldn't understand why it doesn't work.
Please help out. Thanks.