java check if class implements interface
Java[Edit]
+
0
-
0
java check if class implements interface
1 2 3if (SomeInterface.class.isAssignableFrom(SomeClass.class)) { // ... }
[Edit]
+
0
-
0
java check if class implements interface
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21// Example interface interface SomeInterface { // ... } // Example class class SomeClass implements SomeInterface { // ... } // Inheritance testing: Class<?> interfaceType = SomeInterface.class; Class<?> classType = SomeClass.class; if (interfaceType.isAssignableFrom(classType)) { // ... }
[Edit]
+
0
-
0
java check if class implements interface
1 2 3 4 5 6Class<?> interfaceType = SomeInterface.class; Class<?> classType = SomeClass.class; if (interfaceType.isAssignableFrom(classType)) { // ... }