/** * 1、可以通过-componentClassName设置新的组件类名 * * <p>2、可以通过-components设置以输入的字符串开头的一组package为一个组件,组件间以;分开 */ public void initArgs(String[] args) throws JDependException { if (args != null) { for (int i = 0; i < args.length; i++) { if (args[i].equalsIgnoreCase("-componentClassName")) { if (args.length <= i + 1) { usage("componentClassName not specified."); } try { Component component = (Component) DefaultCommand.class.getClassLoader().loadClass(args[++i]).newInstance(); if (args.length > i + 1 && !args[i + 1].startsWith("-")) component.init(this.group, this.name, args[++i]); else component.init(this.group, this.name, null); serviceProxy.setComponent(component); } catch (Exception e) { e.printStackTrace(); } } else if (args[i].equalsIgnoreCase("-components")) { if (args.length <= i + 1) { usage("Components not specified."); } serviceProxy.setComponent(SimpleComponent.calSimpleComponent(args[++i], ";")); } else { i++; } } } }
/** * Analyzes the registered directories, generates metrics for each Java package, and reports the * metrics. * * @throws JDependException */ private AnalysisResult analyze() throws JDependException { return serviceProxy.analyze(); }
/** * Adds the specified directory name to the collection of directories to be analyzed. * * @param name Directory name. * @throws JDependException */ public void addDirectory(String name) throws JDependException { serviceProxy.addDirectory(name); }