src/jdk.javadoc/share/classes/jdk/javadoc/doclet/DocletEnvironment.java
author lancea
Thu, 14 Mar 2019 10:50:35 -0400
changeset 54126 478f1483c511
parent 47216 71c04702a3d5
permissions -rw-r--r--
8220252: Fix Headings in java.naming Reviewed-by: dfuchs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
     1
/*
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
     4
 *
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    10
 *
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    15
 * accompanied this code).
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    16
 *
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    20
 *
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    23
 * questions.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    24
 */
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    25
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    26
package jdk.javadoc.doclet;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    27
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    28
import java.util.Set;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    29
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    30
import javax.lang.model.SourceVersion;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    31
import javax.lang.model.element.Element;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    32
import javax.lang.model.element.TypeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    33
import javax.lang.model.util.Elements;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    34
import javax.lang.model.util.Types;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    35
import javax.tools.JavaFileManager;
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    36
import javax.tools.JavaFileObject.Kind;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    37
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    38
import com.sun.source.util.DocTrees;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    39
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    40
/**
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    41
 * Represents the operating environment of a single invocation
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    42
 * of the doclet. This object can be used to access the program
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    43
 * structures, various utilities and the user specified elements
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    44
 * on the command line.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    45
 *
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    46
 * @since 9
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    47
 */
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    48
public interface DocletEnvironment {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
    49
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
    50
    /**
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    51
     * Returns the elements <a href="package-summary.html#specified">specified</a>
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    52
     * when the tool is invoked.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    53
     *
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    54
     * @return the set of specified elements
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    55
     */
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    56
    Set<? extends Element> getSpecifiedElements();
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
    57
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
    58
    /**
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    59
     * Returns the module, package and type elements that should be
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    60
     * <a href="package-summary.html#included">included</a> in the
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    61
     * documentation.
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
    62
     *
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    63
     * @return the set of included elements
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
    64
     */
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    65
    Set<? extends Element> getIncludedElements();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    66
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    67
    /**
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    68
     * Returns an instance of the {@code DocTrees} utility class.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    69
     * This class provides methods to access {@code TreePath}s, {@code DocCommentTree}s
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    70
     * and so on.
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
    71
     *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
    72
     * @return a utility class to operate on doc trees
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    73
     */
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    74
    DocTrees getDocTrees();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    75
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    76
    /**
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    77
     * Returns an instance of the {@code Elements} utility class.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    78
     * This class provides methods for operating on
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    79
     * {@link javax.lang.model.element.Element elements}.
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
    80
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    81
     * @return a utility class to operate on elements
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    82
     */
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    83
    Elements getElementUtils();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    84
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    85
    /**
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    86
     * Returns an instance of the {@code Types} utility class.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    87
     * This class provides methods for operating on
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    88
     * {@link javax.lang.model.type.TypeMirror type mirrors}.
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
    89
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    90
     * @return a utility class to operate on type mirrors
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    91
     */
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    92
    Types getTypeUtils();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    93
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    94
    /**
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    95
     * Returns true if an element should be
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    96
     * <a href="package-summary.html#included">included</a> in the
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    97
     * documentation.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
    98
     *
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
    99
     * @param e the element
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   100
     * @return true if included, false otherwise
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   101
     */
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   102
    boolean isIncluded(Element e);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   103
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   104
    /**
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   105
     * Returns true if the element is <a href="package-summary.html#selected">selected</a>.
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   106
     *
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   107
     * @param e the element
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   108
     * @return true if selected, false otherwise
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   109
     */
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   110
    boolean isSelected(Element e);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   111
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   112
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   113
     * Returns the file manager used to read and write files.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   114
     *
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   115
     * @return the file manager used to read and write files
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   116
     */
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   117
    JavaFileManager getJavaFileManager();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   118
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   119
    /**
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   120
     * Returns the source version of the source files that were read.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   121
     *
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   122
     * @return the source version
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   123
     */
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   124
    SourceVersion getSourceVersion();
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
   125
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
   126
    /**
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
   127
     * Returns the required level of module documentation.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
   128
     *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
   129
     * @return the required level of module documentation
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
   130
     */
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   131
    ModuleMode getModuleMode();
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   132
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   133
    /**
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   134
     * Returns the file kind of a type element.
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   135
     *
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   136
     * @param type the type element
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   137
     * @return the file kind
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   138
     */
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 40508
diff changeset
   139
    Kind getFileKind(TypeElement type);
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
   140
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
   141
    enum ModuleMode {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
   142
        /** Indicate API level documentation is required */
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
   143
        API,
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
   144
        /** Indicate Detailed documentation is required */
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
   145
        ALL
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 35426
diff changeset
   146
    }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
diff changeset
   147
}