codestyle/src/main/java/se/jguru/nazgul/tools/codestyle/enforcer/rules/CorrectPackagingRule.java
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;
        }
    }
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;
        }
    }
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.

@param packageExtractorImplementations a comma-separated string holding fully qualified class names of the
PackageExtractor implementations. Each such class must have a default
(i.e. no-argument) constructor.
@throws IllegalArgumentException if the supplied packageExtractorImplementations argument could not yield an
instantiated PackageExtractor instance.
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 .