/** * Returns all classes. * * @return a collections with all classes */ public String[] getAllClassNames() { Collection classes = m_builder.getClassLibrary().all(); Collection classNames = new ArrayList(); String className = null; for (Iterator it = classes.iterator(); it.hasNext(); ) { className = (String) it.next(); if ("java.lang.Object".equals(className)) continue; classNames.add(className); } return (String[]) classNames.toArray(new String[] {}); }
/** * Produces the {@link JavaDocBuilder} used to analyze classes and source files. * * @param parent parent classloader * @return The {@link JavaDocBuilder} used to analyze classes and source files. * @throws MojoExecutionException If we fail to produce the {@link JavaDocBuilder}. (Fail early.) */ private JavaDocBuilder createJavaDocBuilder(ClassLoader parent) throws MojoExecutionException { JavaDocBuilder builder = new JavaDocBuilder(); builder.addSourceTree(new File(project.getBuild().getSourceDirectory())); // Quick and dirty hack for adding Classloaders with the definitions of // classes the sources depend upon. try { URLClassLoader loader = getProjectClassLoader(parent); builder.getClassLibrary().addClassLoader(loader); } catch (InvalidDependencyVersionException idve) { idve.printStackTrace(); } catch (MalformedURLException e) { throw new MojoExecutionException("Malformed artifact URLs.", e); } return builder; }