📄 main.java
字号:
} option_exclude.add(packageName); } } }); // TODO include other options here options.put("-verbose", new OptionProcessor(1) { void process(String[] args) { option_verbose = true; System.err.println("WARNING: Unsupported option -verbose ignored"); } }); options.put("-quiet", new OptionProcessor(1) { void process(String[] args) { reporter.setQuiet(true); } }); options.put("-locale", new OptionProcessor(2) { void process(String[] args) { String localeName = args[0]; String language = null; String country = null; String variant = null; StringTokenizer st = new StringTokenizer(localeName, "_"); if (st.hasMoreTokens()) { language = st.nextToken(); } if (st.hasMoreTokens()) { country = st.nextToken(); } if (st.hasMoreTokens()) { variant = st.nextToken(); } if (variant != null) { option_locale = new Locale(language, country, variant); } else if (country != null) { option_locale = new Locale(language, country); } else if (language != null) { option_locale = new Locale(language); } else { throw new RuntimeException("Illegal locale specification '" + localeName + "'"); } } }); options.put("-encoding", new OptionProcessor(2) { void process(String[] args) { option_encoding = args[0]; } }); options.put("-breakiterator", new OptionProcessor(1) { void process(String[] args) { option_breakiterator = true; } }); options.put("-licensetext", new OptionProcessor(1) { void process(String[] args) { option_licensetext = true; } }); options.put("-overview", new OptionProcessor(2) { void process(String[] args) { try { getRootDoc().setRawCommentText(RootDocImpl.readHtmlBody(new File(args[0]))); } catch (IOException e) { throw new RuntimeException("Cannot read file specified in option -overview: " + e.getMessage()); } } }); options.put("-classpath", new OptionProcessor(2) { void process(String[] args) { reporter.printWarning("-classpath option could not be passed to the VM. Faking it with "); reporter.printWarning(" System.setProperty(\"java.class.path\", \"" + args[0] + "\");"); System.setProperty("java.class.path", args[0]); } }); options.put("--version", new OptionProcessor(1) { void process(String[] args) { option_showVersion = true; } }); options.put("-bootclasspath", new OptionProcessor(1) { void process(String[] args) { option_bootclasspath_specified = true; } }); options.put("-all", new OptionProcessor(1) { void process(String[] args) { option_all = true; } }); options.put("-reflection", new OptionProcessor(1) { void process(String[] args) { option_reflection = true; } }); } /** * Determine how many arguments the given option requires. * * @param option * The name of the option without leading dash. */ private static int optionLength(String option) { OptionProcessor op = (OptionProcessor) options.get(option.toLowerCase()); if (op != null) return op.argCount; else return 0; } /** * Process all given options. Assumes that the options have been validated * before. * * @param optionArr * Each element is a series of Strings where [0] is the name of the * option and [1..n] are the arguments to the option. */ private void readOptions(String[][] optionArr) { //--- For each option, find the appropriate OptionProcessor // and call its process() method for (int i = 0; i < optionArr.length; ++i) { String[] opt = optionArr[i]; String[] args = new String[opt.length - 1]; System.arraycopy(opt, 1, args, 0, opt.length - 1); OptionProcessor op = (OptionProcessor) options.get(opt[0].toLowerCase()); op.process(args); } } /** * Print command line usage. */ private static void usage() { System.out .print("\n" + "USAGE: gjdoc [options] [packagenames] " + "[sourcefiles] [@files]\n\n" + " --version Show version information and exit\n" + " -all Process all source files found in the source path\n" + " -overview <file> Read overview documentation from HTML file\n" + " -public Include only public classes and members\n" + " -protected Include protected and public classes and members\n" + " This is the default\n" + " -package Include package/protected/public classes and members\n" + " -private Include all classes and members\n" + " -help, --help Show this information\n" + " -doclet <class> Doclet class to use for generating output\n" + " -docletpath <classpath> Specifies the search path for the doclet and\n" + " dependencies\n" + " -source <release> Provide source compatibility with specified\n" + " release (1.4 to handle assertion)\n" + " -sourcepath <pathlist> Where to look for source files\n" + " -s <pathlist> Alias for -sourcepath\n" + " -subpackages <spkglist> List of subpackages to recursively load\n" + " -exclude <pkglist> List of packages to exclude\n" + " -verbose Output messages about what Gjdoc is doing [ignored]\n" + " -quiet Do not print non-error and non-warning messages\n" + " -locale <name> Locale to be used, e.g. en_US or en_US_WIN\n" + " -encoding <name> Source file encoding name\n" + " -breakiterator Compute first sentence with BreakIterator\n" + " -classpath <pathlist> Set the path used for loading auxilliary classes\n" + "\n" + "Standard doclet options:\n" + " -d Set target directory\n" + " -use Includes the 'Use' page for each documented class\n" + " and package\n" + " -version Includes the '@version' tag\n" + " -author Includes the '@author' tag\n" + " -splitindex Splits the index file into multiple files\n" + " -windowtitle <text> Browser window title\n" + " -doctitle <text> Title near the top of the overview summary file\n" + " (HTML allowed)\n" + " -title <text> Title for this set of API documentation\n" + " (deprecated, -doctitle should be used instead)\n" + " -header <text> Text to include in the top navigation bar\n" + " (HTML allowed)\n" + " -footer <text> Text to include in the bottom navigation bar\n" + " (HTML allowed)\n" + " -bottom <text> Text to include at the bottom of each output file\n" + " (HTML allowed)\n" + " -link <extdoc URL> Link to external generated documentation at URL\n" + " -linkoffline <extdoc URL> <packagelistLoc>\n" + " Link to external generated documentation for\n" + " the specified package-list\n" + " -linksource Creates an HTML version of each source file\n" + " -group <groupheading> <packagepattern:packagepattern:...>\n" + " Separates packages on the overview page into groups\n" + " -nodeprecated Prevents the generation of any deprecated API\n" + " -nodeprecatedlist Prevents the generation of the file containing\n" + " the list of deprecated APIs and the link to the\n" + " navigation bar to that page\n" + " -nosince Omit the '@since' tag\n" + " -notree Do not generate the class/interface hierarchy page\n" + " -noindex Do not generate the index file\n" + " -nohelp Do not generate the help link\n" + " -nonavbar Do not generate the navbar, header and footer\n" + " -helpfile <filen> Path to an alternate help file\n" + " -stylesheetfile <file> Path to an alternate CSS stylesheet\n" + " -addstylesheet <file> Path to an additional CSS stylesheet\n" + " -serialwarn Complain about missing '@serial' tags [ignored]\n" + " -charset <IANACharset> Specifies the HTML charset\n" + " -docencoding <IANACharset>\n" + " Specifies the encoding of the generated HTML files\n" + " -tag <tagname>:Xaoptcmf:\"<taghead>\"\n" + " Enables gjdoc to interpret a custom tag\n" + " -taglet Adds a Taglet class to the map of taglets\n" + " -tagletpath Sets the CLASSPATH to load subsequent Taglets from\n" + " -docfilessubdirs Enables deep copy of 'doc-files' directories\n" + " -excludedocfilessubdir <name1:name2:...>\n" + " Excludes 'doc-files' subdirectories with a give name\n" + " -noqualifier all|<packagename1:packagename2:...>\n" + " Do never fully qualify given package names\n" + " -nocomment Suppress the entire comment body including the main\n" + " description and all tags, only generate declarations\n" + "\n" + "Gjdoc extension options:\n" + " -reflection Use reflection for resolving unqualified class names\n" + " -licensetext Include license text from source files\n" + " -validhtml Use valid HTML/XML names (breaks compatibility)\n" + " -baseurl <url> Hardwire the given base URL into generated pages\n" /** + " -genhtml Generate HTML code instead of XML code. This is the\n" + " default.\n" + " -geninfo Generate Info code instead of XML code.\n" + " -xslsheet <file> If specified, XML files will be written to a\n" + " temporary directory and transformed using the\n" + " given XSL sheet. The result of the transformation\n" + " is written to the output directory. Not required if\n" + " -genhtml or -geninfo has been specified.\n" + " -xmlonly Generate XML code only, do not generate HTML code.\n" + " -bottomnote HTML code to include at the bottom of each page.\n" + " -nofixhtml If not specified, heurestics will be applied to\n" + " fix broken HTML code in comments.\n" + " -nohtmlwarn Do not emit warnings when encountering broken HTML\n" + " code.\n" + " -noemailwarn Do not emit warnings when encountering strings like\n" + " <abc@foo.com>.\n" + " -indentstep <n> How many spaces to indent each tag level in\n" + " generated XML code.\n" + " -xsltdriver <class> Specifies the XSLT driver to use for transformation.\n" + " By default, xsltproc is used.\n" + " -postprocess <class> XmlDoclet postprocessor class to apply after XSL\n" + " transformation.\n" + " -compress Generated info pages will be Zip-compressed.\n" + " -workpath Specify a temporary directory to use.\n" + " -authormail <type> Specify handling of mail addresses in @author tags.\n" + " no-replace do not replace mail addresses (default).\n" + " mailto-name replace by <a>Real Name</a>.\n" + " name-mailto-address replace by Real Name (<a>abc@foo.com</a>).\n" + " name-mangled-address replace by Real Name (<a>abc AT foo DOT com</a>).\n" **/ ); } /** * The root of the gjdoc tool. * * @return all the options of the gjdoc application. */ public static RootDocImpl getRootDoc() { return rootDoc; } /** * Get the gjdoc singleton. * * @return the gjdoc instance. */ public static Main getInstance() { return instance; } /** * Is this access level covered? * * @param accessLevel * the access level we want to know if it is covered. * @return true if the access level is covered. */ public boolean includeAccessLevel(int accessLevel) { return coverageTemplates[option_coverage][accessLevel]; } /** * Is the doclet running? * * @return true if it's running */ public boolean isDocletRunning() { return docletRunning; } /** * Check the charset. Check that all the characters of the string 'toCheck' * and query if they exist in the 'charSet'. The order does not matter. The * number of times a character is in the variable does not matter. * * @param toCheck * the charset to check. * @param charSet * the reference charset * @return true if they match. */ public static boolean checkCharSet(String toCheck, String charSet) { for (int i = 0; i < toCheck.length(); ++i) { if (charSet.indexOf(toCheck.charAt(i)) < 0) return false; } return true; } /** * Makes the RootDoc eligible for the GC. */ public static void releaseRootDoc() { rootDoc.flush(); } /** * Return whether the -breakiterator option has been specified. */ public boolean isUseBreakIterator() { return this.option_breakiterator || !getLocale().getLanguage().equals(Locale.ENGLISH.getLanguage()); } /** * Return whether boilerplate license text should be copied. */ public boolean isCopyLicenseText() { return this.option_licensetext; } /** * Return the locale specified using the -locale option or the * default locale; */ public Locale getLocale() { return this.option_locale; } /** * Return the collator to use based on the specified -locale * option. If no collator can be found for the given locale, a * warning is emitted and the default collator is used instead. */ public Collator getCollator() { if (null == this.collator) { Locale locale = getLocale(); this.collator = Collator.getInstance(locale); Locale defaultLocale = Locale.getDefault(); if (null == this.collator && !defaultLocale.equals(locale)) { this.collator = Collator.getInstance(defaultLocale); if (null != this.collator) { reporter.printWarning("No collator found for locale " + locale.getDisplayName() + "; using collator for default locale " + defaultLocale.getDisplayName() + "."); } else { this.collator = Collator.getInstance(); reporter.printWarning("No collator found for specified locale " + locale.getDisplayName() + " or default locale " + defaultLocale.getDisplayName() + ": using default collator."); } } if (null == this.collator) { this.collator = Collator.getInstance(); reporter.printWarning("No collator found for locale " + locale.getDisplayName() + ": using default collator."); } } return this.collator; } public boolean isCacheRawComments() { return true; } public String getGjdocVersion() { if (null == gjdocVersion) { try { Properties versionProperties = new Properties(); versionProperties.load(getClass().getResourceAsStream("/version.properties")); gjdocVersion = versionProperties.getProperty("gjdoc.version"); } catch (IOException ignore) { } if (null == gjdocVersion) { gjdocVersion = "unknown"; } } return gjdocVersion; } public boolean isReflectionEnabled() { return this.option_reflection; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -