visualization/visualization-spi-doclet/src/main/java/se/jguru/nazgul/tools/visualization/spi/doclet/DelegatingDoclet.java
public static SimpleDoclet createSimpleDoclet(final String className) {

        final String effectiveClassName = className != null && !className.isEmpty()
                ? className
                : VisualizationDoclet.class.getName();

        final ClassLoader[] classLoaders = new ClassLoader[]{
                Thread.currentThread().getContextClassLoader(),
                DelegatingDoclet.class.getClassLoader()};

        SimpleDoclet toReturn = null;

        for (ClassLoader current : classLoaders) {
            try {
                final Class<?> loadedClass = current.loadClass(effectiveClassName);
                if (SimpleDoclet.class.isAssignableFrom(loadedClass)) {
                    toReturn = (SimpleDoclet) loadedClass.newInstance();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        // All Done.
        return toReturn == null ? new VisualizationDoclet() : toReturn;
    }
public static SimpleDoclet createSimpleDoclet(final String className) {

        final String effectiveClassName = className != null && !className.isEmpty()
                ? className
                : VisualizationDoclet.class.getName();

        final ClassLoader[] classLoaders = new ClassLoader[]{
                Thread.currentThread().getContextClassLoader(),
                DelegatingDoclet.class.getClassLoader()};

        SimpleDoclet toReturn = null;

        for (ClassLoader current : classLoaders) {
            try {
                final Class<?> loadedClass = current.loadClass(effectiveClassName);
                if (SimpleDoclet.class.isAssignableFrom(loadedClass)) {
                    toReturn = (SimpleDoclet) loadedClass.newInstance();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        // All Done.
        return toReturn == null ? new VisualizationDoclet() : toReturn;
    }
public static SimpleDoclet createSimpleDoclet ( final String className ) { final String effectiveClassName = className != null && ! className . isEmpty ( ) ? className : VisualizationDoclet . class . getName ( ) ; final ClassLoader [ ] classLoaders = new ClassLoader [ ] { Thread . currentThread ( ) . getContextClassLoader ( ) , DelegatingDoclet . class . getClassLoader ( ) } ; SimpleDoclet toReturn = null ; for ( ClassLoader current : classLoaders ) { try { final Class < ? > loadedClass = current . loadClass ( effectiveClassName ) ; if ( SimpleDoclet . class . isAssignableFrom ( loadedClass ) ) { toReturn = ( SimpleDoclet ) loadedClass . newInstance ( ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } } // All Done. return toReturn == null ? new VisualizationDoclet ( ) : toReturn ; }
Creates a SimpleDoclet instance by calling a no-argument constructor within the Class of the supplied ClassName.
Falls back to {@link VisualizationDoclet}.

@param className A fully qualified classname of a SimpleDoclet implementation.
@return An instance of the supplied ClassName - or an {@link VisualizationDoclet} as a fallback.
Creates a SimpleDoclet instance by calling a no - argument constructor within the Class of the supplied ClassName . Falls back to { @link VisualizationDoclet } .