All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jdk.javadoc.internal.doclets.toolkit.BaseOptions Maven / Gradle / Ivy

There is a newer version: 21.0.0
Show newest version
/*
 * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

package jdk.javadoc.internal.doclets.toolkit;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.MissingResourceException;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.stream.Collectors;

import jdk.javadoc.doclet.Doclet;
import jdk.javadoc.doclet.Reporter;
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
import jdk.javadoc.internal.doclets.toolkit.util.Utils;

import static javax.tools.Diagnostic.Kind.ERROR;
import org.frgaal.CollectionShims;

/**
 * Storage for the format-independent options supported by the toolkit.
 * The objects to handle command-line options, and to initialize this
 * object, are all subtypes of {@link BaseOptions.Option},
 * returned by {@link BaseOptions#getSupportedOptions()}.
 *
 * 

Some of the methods used to access the values of options * have names that begin with a verb, such as {@link #copyDocfileSubdirs} * or {@link #showVersion}. Unless otherwise stated, * these methods should all be taken as just accessing the value * of the associated option. */ public abstract class BaseOptions { // /** * Argument for command-line option {@code --allow-script-in-comments}. * Allow JavaScript in doc comments. */ private boolean allowScriptInComments = false; /** * Argument for command-line option {@code -docfilessubdirs}. * True if we should recursively copy the doc-file subdirectories */ private boolean copyDocfileSubdirs = false; /** * Arguments for command-line option {@code -tag} and {@code -taglet}. */ private final LinkedHashSet> customTagStrs = new LinkedHashSet<>(); /** * Argument for command-line option {@code -d}. * Destination directory name, in which doclet will generate the entire * documentation. Default is current directory. */ private String destDirName = ""; /** * Argument for command-line option {@code --disable-javafx-strict-checks}. * Primarily used to disable strict checks in the regression * tests allowing those tests to be executed successfully, for * instance, with OpenJDK builds which may not contain FX libraries. */ private boolean disableJavaFxStrictChecks = false; /** * Argument for command-line option {@code -docencoding}. * Encoding for this document. Default is default encoding for this * platform. */ private String docEncoding = null; /** * Argument for command-line option {@code ???}. * Destination directory name, in which doclet will copy the doc-files to. */ private String docFileDestDirName = ""; /** * Argument for hidden command-line option {@code --dump-on-error}. */ private boolean dumpOnError = false; /** * Argument for command-line option {@code -encoding}. * Encoding for this document. Default is default encoding for this * platform. */ private String encoding = null; /** * Argument for command-line option {@code -excludedocfilessubdir}. * The set of doc-file subdirectories to exclude. */ private Set excludedDocFileDirs; /** * Argument for command-line option {@code -noqualifier}. * The set of qualifiers to exclude. */ private Set excludedQualifiers; /** * Arguments for command-line option {@code -group} */ private List> groupPairs; /** * Argument for command-line option {@code --javafx} or {@code -javafx}. * Generate documentation for JavaFX getters and setters automatically * by copying it from the appropriate property definition. */ private boolean javafx = false; /** * Argument for command-line option {@code -keywords}. * True if user wants to add member names as meta keywords. * Set to false because meta keywords are ignored in general * by most Internet search engines. */ private boolean keywords = false; /** * Arguments for command-line option {@code -link}. */ // A list containing urls private final List linkList = new ArrayList<>(); /** * Arguments for command-line option {@code -linkoffline}. */ // A list of pairs containing urls and package list private final List> linkOfflineList = new ArrayList<>(); /** * Location of alternative platform link properties file. */ private String linkPlatformProperties; /** * Argument for command-line option {@code -linksource}. * True if we should generate browsable sources. */ private boolean linkSource = false; /** * Argument for command-line option {@code -nocomment}. * True if user wants to suppress descriptions and tags. */ private boolean noComment = false; /** * Argument for command-line option {@code -nodeprecated}. * Don't generate deprecated API information at all, if -nodeprecated * option is used. nodeprecated is set to true if * -nodeprecated option is used. Default is generate deprecated API * information. */ private boolean noDeprecated = false; /** * Argument for command-line option {@code --no-platform-links}. * True if command-line option "--no-platform-links" is used. Default value is * false. */ private boolean noPlatformLinks = false; /** * Argument for command-line option {@code -nosince}. * True if command-line option "-nosince" is used. Default value is * false. */ private boolean noSince = false; /** * Argument for command-line option {@code -notimestamp}. * True if user wants to suppress time stamp in output. * Default is false. */ private boolean noTimestamp = false; /** * Argument for command-line option {@code -quiet}. * Suppress all messages */ private boolean quiet = false; /** * Argument for command-line option {@code -serialwarn}. * This is true if option "-serialwarn" is used. Default value is false to * suppress excessive warnings about serial tag. */ private boolean serialWarn = false; /** * Argument for command-line option {@code -author}. * Generate author specific information for all the classes if @author * tag is used in the doc comment and if -author option is used. * showauthor is set to true if -author option is used. * Default is don't show author information. */ private boolean showAuthor = false; /** * Argument for command-line option {@code --show-taglets}. * Show taglets (internal debug switch) */ private boolean showTaglets = false; /** * Argument for command-line option {@code -version}. * Generate version specific information for the all the classes * if @version tag is used in the doc comment and if -version option is * used. {@code showVersion} is set to true if -version option is * used. Default is don't show version information. */ private boolean showVersion = false; /** * Argument for command line option {@code --since}. * Specifies a list of release names for which to document API changes. */ private List since = CollectionShims.list(); /** * Argument for command line option {@code --since-label}. * Specifies custom text to use as heading of New API page. */ private String sinceLabel; /** * Argument for command-line option {@code -sourcetab}. * The specified amount of space between tab stops. */ private int sourceTabSize; /** * Value for command-line option {@code --override-methods summary} * or {@code --override-methods detail}. * Specifies whether those methods that override a super-type's method * with no changes to the API contract should be summarized in the * footnote section. */ private boolean summarizeOverriddenMethods = false; /** * Argument for command-line option {@code -tagletpath}. * The path to Taglets */ private String tagletPath = null; // private final BaseConfiguration config; protected BaseOptions(BaseConfiguration config) { this.config = config; excludedDocFileDirs = new HashSet<>(); excludedQualifiers = new HashSet<>(); sourceTabSize = DocletConstants.DEFAULT_TAB_STOP_LENGTH; groupPairs = new ArrayList<>(0); } public Set getSupportedOptions() { Resources resources = config.getDocResources(); Messages messages = config.getMessages(); Reporter reporter = config.getReporter(); List





© 2015 - 2024 Weber Informatics LLC | Privacy Policy