/** * Create inheritance tree only for the classes passed as parameter * * <p> * Private classes will be ignored * * @param classNames * @return */ public static InheritanceTree createFromClassList(Collection<String> classNames) throws IllegalArgumentException { if (classNames == null || classNames.isEmpty()) { throw new IllegalArgumentException("No class name defined"); } InheritanceTree inheritanceTree = new InheritanceTree(); for (String className : classNames) { if (className == null) { throw new IllegalArgumentException("Null class name"); } analyzeClassName(inheritanceTree, className); } // Remove all classes not in the parameter list, otherwise we get the superclasses from outside the list Set<String> classes = new HashSet<>(inheritanceTree.getAllClasses()); for (String className : classes) { if (!classNames.contains(className)) inheritanceTree.removeClass(className); } return inheritanceTree; }