private List < FeatureInstaller > prepareInstallers ( final List < Class < ? extends FeatureInstaller > > installerClasses ) { final List < FeatureInstaller > installers = Lists . newArrayList ( ) ; // different instance then used in guice context, but it's just an accessor object final Options options = new Options ( context . options ( ) ) ; for ( Class < ? extends FeatureInstaller > installerClass : installerClasses ) { try { final FeatureInstaller installer = installerClass . newInstance ( ) ; installers . add ( installer ) ; if ( WithOptions . class . isAssignableFrom ( installerClass ) ) { ( ( WithOptions ) installer ) . setOptions ( options ) ; } } catch ( Exception e ) { throw new IllegalStateException ( "Failed to register installer " + installerClass . getName ( ) , e ) ; } } return installers ; }
Instantiate all found installers using default constructor .