public static void checkSuperClass ( Service s , Class < ? > subClass , Class < ? > superClass ) throws NoSuchAlgorithmException { if ( superClass == null ) { return ; } if ( superClass . isAssignableFrom ( subClass ) == false ) { throw new NoSuchAlgorithmException ( "class configured for " + s . getType ( ) + ": " + s . getClassName ( ) + " not a " + s . getType ( ) ) ; } }
Check is subClass is a subclass of superClass . If not throw a NoSuchAlgorithmException .