public static boolean implementsInterfaceWithSameName ( Class < ? > clazz , Class < ? > iface ) { Class < ? > [ ] interfaces = getAllInterfaces ( clazz ) ; for ( Class implementedInterface : interfaces ) { if ( implementedInterface . getName ( ) . equals ( iface . getName ( ) ) ) { return true ; } } return false ; }
Check whether given class implements an interface with the same name . It returns true even when the implemented interface is loaded by a different classloader and hence the class is not assignable into it .