static < T , X extends T > T createProviderForClass ( final PluggableService < T > service , final Class < X > cls ) throws PluginException , ProviderCreationException { debug ( "Try loading provider " + cls . getName ( ) ) ; if ( ! ( service instanceof JavaClassProviderLoadable ) ) { return null ; } JavaClassProviderLoadable < T > loadable = ( JavaClassProviderLoadable < T > ) service ; final Plugin annotation = getPluginMetadata ( cls ) ; final String pluginname = annotation . name ( ) ; if ( ! loadable . isValidProviderClass ( cls ) ) { throw new PluginException ( "Class " + cls . getName ( ) + " was not a valid plugin class for service: " + service . getName ( ) + ". Expected class " + cls . getName ( ) + ", with a public constructor with no parameter" ) ; } debug ( "Succeeded loading plugin " + cls . getName ( ) + " for service: " + service . getName ( ) ) ; return loadable . createProviderInstance ( cls , pluginname ) ; }
Attempt to create an instance of thea provider for the given service