public boolean isOverridden ( Object instance , Method origin ) { Class < ? > currentType = instance . getClass ( ) ; do { try { return ! origin . equals ( currentType . getDeclaredMethod ( origin . getName ( ) , origin . getParameterTypes ( ) ) ) ; } catch ( NoSuchMethodException ignored ) { currentType = currentType . getSuperclass ( ) ; } } while ( currentType != null ) ; return true ; }
Check if a method is overridden .