private void findPluginsForDescriptor ( final CommandLinePluginDescriptor < ? > pluginDescriptor ) { final ClassFinder classFinder = new ClassFinder ( ) ; pluginDescriptor . getPackageNames ( ) . forEach ( pkg -> classFinder . find ( pkg , pluginDescriptor . getPluginBaseClass ( ) ) ) ; final Set < Class < ? > > pluginClasses = classFinder . getClasses ( ) ; for ( Class < ? > c : pluginClasses ) { if ( pluginDescriptor . includePluginClass ( c ) ) { try { final Object plugin = pluginDescriptor . createInstanceForPlugin ( c ) ; createArgumentDefinitions ( plugin , pluginDescriptor ) ; } catch ( InstantiationException | IllegalAccessException e ) { throw new CommandLineException . CommandLineParserInternalException ( "Problem making an instance of plugin " + c + " Do check that the class has a non-arg constructor" , e ) ; } } } }
instance each and add its ArgumentDefinitions