public final void setPackageExtractors ( final String packageExtractorImplementations ) throws IllegalArgumentException { // Check sanity if ( packageExtractorImplementations == null ) { throw new NullPointerException ( "Cannot handle empty packageExtractorImplementations argument." ) ; } // Instantiate the PackageExtractor instances. List < PackageExtractor > extractors = new ArrayList < PackageExtractor > ( ) ; for ( String current : splice ( packageExtractorImplementations ) ) { try { // Load the current PackageExtractor implementation class final Class < ? > aClass = getClass ( ) . getClassLoader ( ) . loadClass ( current ) ; // The PackageExtractor implementation must have a default constructor. // Fire, and handle any exceptions. extractors . add ( ( PackageExtractor ) aClass . newInstance ( ) ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Could not instantiate PackageExtractor from class [" + current + "]. Validate that implementation has a default constructor, and implements the" + PackageExtractor . class . getSimpleName ( ) + " interface." ) ; } } // Assign if non-null. if ( extractors . size ( ) > 0 ) { this . packageExtractors = extractors ; } }
Splices the supplied packageExtractorImplementations argument which is assumed to be a comma - separated string holding fully qualified class names of the PackageExtractor implementations which should be used by this CorrectPackagingRule .