Path: blob/master/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/StandardDoclet.java
41159 views
/*1* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package jdk.javadoc.doclet;2627import java.util.Locale;28import java.util.List;29import java.util.Set;3031import javax.lang.model.element.Element;32import javax.lang.model.SourceVersion;3334import jdk.javadoc.internal.doclets.formats.html.HtmlDoclet;3536/**37* This doclet generates HTML-formatted documentation for the specified modules,38* packages and types.39*40* <h2><a id="user-defined-taglets">User-Defined Taglets</a></h2>41*42* The standard doclet supports user-defined {@link Taglet taglets},43* which can be used to generate customized output for user-defined tags44* in documentation comments.45*46* Taglets invoked by the standard doclet must return strings from47* {@link Taglet#toString(List,Element) Taglet.toString} as follows:48*49* <dl>50* <dt> <i>Inline Tags</i>51* <dd> The returned string must be52* <a href="https://www.w3.org/TR/html52/dom.html#flow-content">flow content</a>,53* or any valid fragment of HTML code that may appear in the body of a document.54* There may be additional constraints, depending on how the tag is to be55* used in a documentation comment: for example, if the tag may be used56* within an inline element such as {@code <b>} or {@code <i>}, the taglet57* must not return a string containing block tags, like {@code <h3>} or58* {@code <p>}.59* <dt> <i>Block Tags</i>60* <dd> The returned string must be suitable content for a definition list,61* or {@code <dl>} element. It will typically be a series of pairs62* of {@code <dt>} and {@code <dd>} elements.63* </dl>64*65* @see <a href="{@docRoot}/../specs/javadoc/doc-comment-spec.html">66* Documentation Comment Specification for the Standard Doclet</a>67*/68public class StandardDoclet implements Doclet {6970private final HtmlDoclet htmlDoclet;7172/**73* Creates an instance of the standard doclet, used to generate HTML-formatted74* documentation.75*/76public StandardDoclet() {77htmlDoclet = new HtmlDoclet(this);78}7980@Override81public void init(Locale locale, Reporter reporter) {82htmlDoclet.init(locale, reporter);83}8485@Override86public String getName() {87return "Standard";88}8990@Override91public Set<? extends Doclet.Option> getSupportedOptions() {92return htmlDoclet.getSupportedOptions();93}9495@Override96public SourceVersion getSupportedSourceVersion() {97return htmlDoclet.getSupportedSourceVersion();98}99100@Override101public boolean run(DocletEnvironment docEnv) {102return htmlDoclet.run(docEnv);103}104105/**106* {@return the locale for this doclet}107*108* @see #init(Locale, Reporter)109*110* @since 17111*/112public Locale getLocale() {113return htmlDoclet.getConfiguration().getLocale();114}115116/**117* {@return the reporter for this doclet}118*119* @see #init(Locale, Reporter)120*121* @since 17122*/123public Reporter getReporter() {124return htmlDoclet.getConfiguration().getReporter();125}126}127128129