org.gradle.external.javadoc.StandardJavadocDocletOptions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-api Show documentation
Show all versions of gradle-api Show documentation
Gradle 6.9.1 API redistribution.
/*
* Copyright 2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.external.javadoc;
import org.gradle.external.javadoc.internal.GroupsJavadocOptionFileOption;
import org.gradle.external.javadoc.internal.JavadocOptionFile;
import org.gradle.external.javadoc.internal.LinksOfflineJavadocOptionFileOption;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* Provides the options for the standard Javadoc doclet.
*/
public class StandardJavadocDocletOptions extends CoreJavadocOptions implements MinimalJavadocOptions {
public StandardJavadocDocletOptions() {
this(new JavadocOptionFile());
}
public StandardJavadocDocletOptions(JavadocOptionFile javadocOptionFile) {
super(javadocOptionFile);
destinationDirectory = addFileOption("d");
use = addBooleanOption("use");
version = addBooleanOption("version");
author = addBooleanOption("author");
splitIndex = addBooleanOption("splitindex");
header = addStringOption("header");
windowTitle = addStringOption("windowtitle");
docTitle = addStringOption("doctitle");
footer = addStringOption("footer");
bottom = addStringOption("bottom");
links = addMultilineStringsOption("link");
linksOffline = addOption(new LinksOfflineJavadocOptionFileOption("linkoffline"));
linkSource = addBooleanOption("linksource");
groups = addOption(new GroupsJavadocOptionFileOption("group"));
noDeprecated = addBooleanOption("nodeprecated");
noDeprecatedList = addBooleanOption("nodeprecatedlist");
noSince = addBooleanOption("nosince");
noTree = addBooleanOption("notree");
noIndex = addBooleanOption("noindex");
noHelp = addBooleanOption("nohelp");
noNavBar = addBooleanOption("nonavbar");
helpFile = addFileOption("helpfile");
stylesheetFile = addFileOption("stylesheetfile");
serialWarn = addBooleanOption("serialwarn");
charSet = addStringOption("charset");
docEncoding = addStringOption("docencoding");
keyWords = addBooleanOption("keywords");
tags = addMultilineStringsOption("tag");
taglets = addMultilineStringsOption("taglet");
tagletPath = addPathOption("tagletpath");
docFilesSubDirs = addBooleanOption("docfilessubdirs");
excludeDocFilesSubDir = addStringsOption("excludedocfilessubdir", ":");
noQualifiers = addStringsOption("noqualifier", ":");
noTimestamp = addBooleanOption("notimestamp");
noComment = addBooleanOption("nocomment");
}
/**
* -d directory
* Specifies the destination directory where javadoc saves the generated HTML files. (The "d" means "destination.")
* Omitting this option causes the files to be saved to the current directory.
* The value directory can be absolute, or relative to the current working directory.
* As of 1.4, the destination directory is automatically created when javadoc is run.
* For example, the following generates the documentation for the package com.mypackage and
* saves the results in the C:/user/doc/ directory:
*
* C:> javadoc -d /user/doc com.mypackage
*/
private final JavadocOptionFileOption destinationDirectory;
@Override
public File getDestinationDirectory() {
return destinationDirectory.getValue();
}
@Override
public void setDestinationDirectory(File directory) {
this.destinationDirectory.setValue(directory);
}
@Override
public StandardJavadocDocletOptions destinationDirectory(File destinationDirectory) {
setDestinationDirectory(destinationDirectory);
return this;
}
/**
* -use
* Includes one "Use" page for each documented class and package. The page describes what packages, classes, methods,
* constructors and fields use any API of the given class or package. Given class C,
* things that use class C would include subclasses of C, fields declared as C, methods that return C,
* and methods and constructors with parameters of type C.
* For example, let's look at what might appear on the "Use" page for String.
* The getName() method in the java.awt.Font class returns type String. Therefore, getName() uses String,
* and you will find that method on the "Use" page for String.
*
* Note that this documents only uses of the API, not the implementation.
* If a method uses String in its implementation but does not take a string as an argument or return a string,
* that is not considered a "use" of String.
*
* You can access the generated "Use" page by first going to the class or package,
* then clicking on the "Use" link in the navigation bar.
*/
private final JavadocOptionFileOption use;
public boolean isUse() {
return use.getValue();
}
public void setUse(boolean use) {
this.use.setValue(use);
}
public StandardJavadocDocletOptions use(boolean use) {
setUse(use);
return this;
}
public StandardJavadocDocletOptions use() {
return use(true);
}
/**
* -version
* Includes the @version text in the generated docs. This text is omitted by default.
* To tell what version of the Javadoc tool you are using, use the -J-version option.
*/
private final JavadocOptionFileOption version;
public boolean isVersion() {
return version.getValue();
}
public void setVersion(boolean version) {
this.version.setValue(version);
}
public StandardJavadocDocletOptions version(boolean version) {
setVersion(version);
return this;
}
public StandardJavadocDocletOptions version() {
return version(true);
}
/**
* -author
* Includes the @author text in the generated docs.
*/
private final JavadocOptionFileOption author;
public boolean isAuthor() {
return author.getValue();
}
public void setAuthor(boolean author) {
this.author.setValue(author);
}
public StandardJavadocDocletOptions author(boolean author) {
setAuthor(author);
return this;
}
public StandardJavadocDocletOptions author() {
return author(true);
}
/**
* -splitindex
* Splits the index file into multiple files, alphabetically, one file per letter,
* plus a file for any index entries that start with non-alphabetical characters.
*/
private final JavadocOptionFileOption splitIndex;
public boolean isSplitIndex() {
return splitIndex.getValue();
}
public void setSplitIndex(boolean splitIndex) {
this.splitIndex.setValue(splitIndex);
}
public StandardJavadocDocletOptions splitIndex(boolean splitIndex) {
setSplitIndex(splitIndex);
return this;
}
public StandardJavadocDocletOptions splitIndex() {
return splitIndex(true);
}
/**
* -windowtitle title
* Specifies the title to be placed in the HTML tag.
* This appears in the window title and in any browser bookmarks (favorite places) that someone creates for this page.
* This title should not contain any HTML tags, as the browser will not properly interpret them.
* Any internal quotation marks within title may have to be escaped. If -windowtitle is omitted,
* the Javadoc tool uses the value of -doctitle for this option.
* C:> javadoc -windowtitle "Java 2 Platform" com.mypackage
*/
private final JavadocOptionFileOption windowTitle;
@Override
public String getWindowTitle() {
return windowTitle.getValue();
}
@Override
public void setWindowTitle(String windowTitle) {
this.windowTitle.setValue(windowTitle);
}
@Override
public StandardJavadocDocletOptions windowTitle(String windowTitle) {
setWindowTitle(windowTitle);
return this;
}
/**
* -header header
* Specifies the header text to be placed at the top of each output file. The header will be placed to the right of
* the upper navigation bar. header may contain HTML tags and white space, though if it does, it must be enclosed
* in quotes. Any internal quotation marks within header may have to be escaped.
* C:> javadoc -header "Java 2 Platform
v1.4" com.mypackage
*/
private final JavadocOptionFileOption header;
@Override
public String getHeader() {
return header.getValue();
}
@Override
public void setHeader(String header) {
this.header.setValue(header);
}
@Override
public StandardJavadocDocletOptions header(String header) {
setHeader(header);
return this;
}
/**
* -doctitle title
* Specifies the title to be placed near the top of the overview summary file. The title will be placed as a centered,
* level-one heading directly beneath the upper navigation bar. The title may contain HTML tags and white space,
* though if it does, it must be enclosed in quotes. Any internal quotation marks within title may have to be escaped.
* C:> javadoc -doctitle "Java<sup><font size=\"-2\">TM</font></sup>" com.mypackage
*/
private final JavadocOptionFileOption docTitle;
public String getDocTitle() {
return docTitle.getValue();
}
public void setDocTitle(String docTitle) {
this.docTitle.setValue(docTitle);
}
public StandardJavadocDocletOptions docTitle(String docTitle) {
setDocTitle(docTitle);
return this;
}
/**
* -footer footer
* Specifies the footer text to be placed at the bottom of each output file.
* The footer will be placed to the right of the lower navigation bar. footer may contain HTML tags and white space,
* though if it does, it must be enclosed in quotes. Any internal quotation marks within footer may have to be escaped.
*/
private final JavadocOptionFileOption footer;
public String getFooter() {
return footer.getValue();
}
public void setFooter(String footer) {
this.footer.setValue(footer);
}
public StandardJavadocDocletOptions footer(String footer) {
setFooter(footer);
return this;
}
/**
* -bottom text
* Specifies the text to be placed at the bottom of each output file.
* The text will be placed at the bottom of the page, below the lower navigation bar.
* The text may contain HTML tags and white space, though if it does, it must be enclosed in quotes.
* Any internal quotation marks within text may have to be escaped.
*/
private final JavadocOptionFileOption bottom;
public String getBottom() {
return bottom.getValue();
}
public void setBottom(String bottom) {
this.bottom.setValue(bottom);
}
public StandardJavadocDocletOptions bottom(String bottom) {
setBottom(bottom);
return this;
}
/**
* -link extdocURL
* Creates links to existing javadoc-generated documentation of external referenced classes. It takes one argument:
*
* extdocURL is the absolute or relative URL of the directory containing the external javadoc-generated documentation
* you want to link to. Examples are shown below.
* The package-list file must be found in this directory (otherwise, use -linkoffline).
* The Javadoc tool reads the package names from the package-list file and then links to those packages at that URL.
* When the Javadoc tool is run, the extdocURL value is copied literally into the <A HREF> links that are created.
* Therefore, extdocURL must be the URL to the directory, not to a file.
* You can use an absolute link for extdocURL to enable your docs to link to a document on any website,
* or can use a relative link to link only to a relative location. If relative,
* the value you pass in should be the relative path from the destination directory (specified with -d) to the directory containing the packages being linked to.
*
* When specifying an absolute link you normally use an http: link. However,
* if you want to link to a file system that has no web server, you can use a file: link -- however,
* do this only if everyone wanting to access the generated documentation shares the same file system.
*/
private final JavadocOptionFileOption> links;
public List getLinks() {
return links.getValue();
}
public void setLinks(List links) {
this.links.setValue(links);
}
public StandardJavadocDocletOptions links(String... links) {
this.links.getValue().addAll(Arrays.asList(links));
return this;
}
public StandardJavadocDocletOptions linksFile(File linksFile) {
return (StandardJavadocDocletOptions) optionFiles(linksFile);
}
/**
* -linkoffline extdocURL packagelistLoc
* This option is a variation of -link; they both create links to javadoc-generated documentation
* for external referenced classes. Use the -linkoffline option when linking to a document on the web
* when the Javadoc tool itself is "offline" -- that is, it cannot access the document through a web connection.
* More specifically, use -linkoffline if the external document's package-list file is not accessible or
* does not exist at the extdocURL location but does exist at a different location,
* which can be specified by packageListLoc (typically local). Thus, if extdocURL is accessible only on the World Wide Web,
* -linkoffline removes the constraint that the Javadoc tool have a web connection when generating the documentation.
*
* Another use is as a "hack" to update docs: After you have run javadoc on a full set of packages,
* then you can run javadoc again on only a smaller set of changed packages,
* so that the updated files can be inserted back into the original set. Examples are given below.
*
* The -linkoffline option takes two arguments -- the first for the string to be embedded in the <a href> links,
* the second telling it where to find package-list:
*
* extdocURL is the absolute or relative URL of the directory containing the external javadoc-generated documentation you want to link to.
* If relative, the value should be the relative path from the destination directory (specified with -d) to the root of the packages being linked to.
* For more details, see extdocURL in the -link option.
* packagelistLoc is the path or URL to the directory containing the package-list file for the external documentation.
* This can be a URL (http: or file:) or file path, and can be absolute or relative. If relative,
* make it relative to the current directory from where javadoc was run. Do not include the package-list filename.
*/
private final JavadocOptionFileOption> linksOffline;
public List getLinksOffline() {
return linksOffline.getValue();
}
public void setLinksOffline(List linksOffline) {
this.linksOffline.setValue(linksOffline);
}
public StandardJavadocDocletOptions linksOffline(String extDocUrl, String packageListLoc) {
this.linksOffline.getValue().add(new JavadocOfflineLink(extDocUrl, packageListLoc));
return this;
}
public StandardJavadocDocletOptions linksOfflineFile(File linksOfflineFile) {
return (StandardJavadocDocletOptions) optionFiles(linksOfflineFile);
}
/**
* -linksource
* Creates an HTML version of each source file (with line numbers) and adds links to them from the standard HTML documentation. Links are created for classes, interfaces, constructors, methods and fields whose declarations are in a source file. Otherwise, links are not created, such as for default constructors and generated classes.
* This option exposes all private implementation details in the included source files, including private classes, private fields, and the bodies of private methods, regardless of the -public, -package, -protected and -private options. Unless you also use the -private option, not all private classes or interfaces will necessarily be accessible via links.
*
* Each link appears on the name of the identifier in its declaration. For example, the link to the source code of the Button class would be on the word "Button":
*
* public class Button
* extends Component
* implements Accessible
* and the link to the source code of the getLabel() method in the Button class would be on the word "getLabel":
* public String getLabel()
*/
private final JavadocOptionFileOption linkSource;
public boolean isLinkSource() {
return linkSource.getValue();
}
public void setLinkSource(boolean linkSource) {
this.linkSource.setValue(linkSource);
}
public StandardJavadocDocletOptions linkSource(boolean linkSource) {
setLinkSource(linkSource);
return this;
}
public StandardJavadocDocletOptions linkSource() {
return linkSource(true);
}
/**
* -group groupheading packagepattern:packagepattern:...
* Separates packages on the overview page into whatever groups you specify, one group per table.
* You specify each group with a different -group option.
* The groups appear on the page in the order specified on the command line; packages are alphabetized within a group.
* For a given -group option, the packages matching the list of packagepattern expressions appear in a table
* with the heading groupheading.
* groupheading can be any text, and can include white space. This text is placed in the table heading for the group.
* packagepattern can be any package name, or can be the start of any package name followed by an asterisk (*).
* The asterisk is a wildcard meaning "match any characters". This is the only wildcard allowed.
* Multiple patterns can be included in a group by separating them with colons (:).
* NOTE: If using an asterisk in a pattern or pattern list, the pattern list must be inside quotes,
* such as "java.lang*:java.util"
* If you do not supply any -group option, all packages are placed in one group with the heading "Packages".
* If the all groups do not include all documented packages,
* any leftover packages appear in a separate group with the heading "Other Packages".
*
* For example, the following option separates the four documented packages into core,
* extension and other packages. Notice the trailing "dot" does not appear in "java.lang*" -- including the dot,
* such as "java.lang.*" would omit the java.lang package.
*
* C:> javadoc -group "Core Packages" "java.lang*:java.util"
* -group "Extension Packages" "javax.*"
* java.lang java.lang.reflect java.util javax.servlet java.new
* This results in the groupings:
* Core Packages
* java.lang
* java.lang.reflect
* java.util
* Extension Packages
* javax.servlet
* Other Packages
* java.new
*/
private final JavadocOptionFileOption
© 2015 - 2025 Weber Informatics LLC | Privacy Policy