public boolean isMetBy ( Class < ? > klass ) { // Classes which aren't capabilities handlers have an assumed // set of capabilities if ( ! CapabilitiesHandler . class . isAssignableFrom ( klass ) ) return isMetBy ( NON_HANDLER_CAPABILITIES ) ; // Attempt to instantiate an instance of the class CapabilitiesHandler instance ; try { instance = ( CapabilitiesHandler ) klass . newInstance ( ) ; } catch ( InstantiationException | IllegalAccessException e ) { throw new RuntimeException ( "Couldn't instantiate CapabilitiesHandler " + klass . getSimpleName ( ) , e ) ; } // Test the instance return isMetBy ( instance ) ; }
Tests if the requirement is met by the given class .