/** * Private method that actually loads the .class files and creates the package structure by * calling a recursive method. * * @param directory - The directory to find the .class files to load. * @return - An intermediary model from which different outputs can be created * @throws ClassNotFoundException * @throws IOException */ private Package loadFiles(String directory) throws ClassNotFoundException, IOException { File file = new File(directory); URL url = file.toURI().toURL(); this.classLoader = new URLClassLoader(new URL[] {url}, getClass().getClassLoader()); Package rootPackage = new Package(file.getName()); List<Package> subpackages = loadFiles(directory, rootPackage); for (Package pckg : subpackages) { if (!pckg.isEmpty()) { rootPackage.addChildrenPackage(pckg); } } this.updateAssociationEntities(rootPackage); return rootPackage; }