langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java
author ksrini
Mon, 05 Jun 2017 13:45:34 -0700
changeset 45417 f7479ee8de69
parent 41452 ddaef4bba083
permissions -rw-r--r--
8177848: Rename Configuration(Impl) classes Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 41452
diff changeset
     2
 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    26
package jdk.javadoc.internal.doclets.toolkit.taglets;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    27
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    28
import java.util.List;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    29
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    30
import javax.lang.model.element.Element;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    31
import javax.lang.model.element.VariableElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    32
import javax.lang.model.type.TypeMirror;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    34
import com.sun.source.doctree.DocTree;
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 41452
diff changeset
    35
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    36
import jdk.javadoc.internal.doclets.toolkit.Content;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    37
import jdk.javadoc.internal.doclets.toolkit.taglets.Taglet.UnsupportedTagletOperationException;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    38
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    39
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * The interface for the taglet writer.
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    44
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    45
 *  If you write code that depends on this, you do so at your own risk.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    46
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    47
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    48
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 * @author Jamie Ho
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
public abstract class TagletWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
     * True if we only want to write the first sentence.
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
     */
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14260
diff changeset
    57
    protected final boolean isFirstSentence;
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14260
diff changeset
    58
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14260
diff changeset
    59
    protected TagletWriter(boolean isFirstSentence) {
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14260
diff changeset
    60
        this.isFirstSentence = isFirstSentence;
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14260
diff changeset
    61
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
    /**
17565
a705fe5e539f 8012174: {@literal} and {@code} should use \"new\" Taglet, not old.
jjg
parents: 16319
diff changeset
    64
     * @return an instance of an output object.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
     */
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
    66
    public abstract Content getOutputInstance();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    /**
31751
ec251536a004 8080880: some docs cleanup for langtools
avstepan
parents: 25874
diff changeset
    69
     * Return the output for a {@code {@code ...}} tag.
17565
a705fe5e539f 8012174: {@literal} and {@code} should use \"new\" Taglet, not old.
jjg
parents: 16319
diff changeset
    70
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    71
     * @param element
17565
a705fe5e539f 8012174: {@literal} and {@code} should use \"new\" Taglet, not old.
jjg
parents: 16319
diff changeset
    72
     * @param tag the tag.
a705fe5e539f 8012174: {@literal} and {@code} should use \"new\" Taglet, not old.
jjg
parents: 16319
diff changeset
    73
     * @return the output of the taglet.
a705fe5e539f 8012174: {@literal} and {@code} should use \"new\" Taglet, not old.
jjg
parents: 16319
diff changeset
    74
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    75
    protected abstract Content codeTagOutput(Element element, DocTree tag);
17565
a705fe5e539f 8012174: {@literal} and {@code} should use \"new\" Taglet, not old.
jjg
parents: 16319
diff changeset
    76
a705fe5e539f 8012174: {@literal} and {@code} should use \"new\" Taglet, not old.
jjg
parents: 16319
diff changeset
    77
    /**
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31751
diff changeset
    78
     * Return the output for a {@index...} tag.
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31751
diff changeset
    79
     *
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31751
diff changeset
    80
     * @param tag the tag.
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31751
diff changeset
    81
     * @return the output of the taglet.
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31751
diff changeset
    82
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    83
    protected abstract Content indexTagOutput(Element element, DocTree tag);
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31751
diff changeset
    84
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31751
diff changeset
    85
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     * Returns the output for the DocRoot inline tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     * @return the output for the DocRoot inline tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     */
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
    89
    protected abstract Content getDocRootOutput();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     * Return the deprecated tag output.
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    94
     * @param element the element to write deprecated documentation for.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
     * @return the output of the deprecated tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    97
    protected abstract Content deprecatedTagOutput(Element element);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
    /**
31751
ec251536a004 8080880: some docs cleanup for langtools
avstepan
parents: 25874
diff changeset
   100
     * Return the output for a {@code {@literal ...}} tag.
17565
a705fe5e539f 8012174: {@literal} and {@code} should use \"new\" Taglet, not old.
jjg
parents: 16319
diff changeset
   101
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   102
     * @param element
17565
a705fe5e539f 8012174: {@literal} and {@code} should use \"new\" Taglet, not old.
jjg
parents: 16319
diff changeset
   103
     * @param tag the tag.
a705fe5e539f 8012174: {@literal} and {@code} should use \"new\" Taglet, not old.
jjg
parents: 16319
diff changeset
   104
     * @return the output of the taglet.
a705fe5e539f 8012174: {@literal} and {@code} should use \"new\" Taglet, not old.
jjg
parents: 16319
diff changeset
   105
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   106
    protected abstract Content literalTagOutput(Element element, DocTree tag);
17565
a705fe5e539f 8012174: {@literal} and {@code} should use \"new\" Taglet, not old.
jjg
parents: 16319
diff changeset
   107
a705fe5e539f 8012174: {@literal} and {@code} should use \"new\" Taglet, not old.
jjg
parents: 16319
diff changeset
   108
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     * Return the header for the param tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     * @param header the header to display.
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     * @return the header for the param tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     */
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   114
    protected abstract Content getParamHeader(String header);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
     * Return the output for param tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   119
     * @param element
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
     * @param paramTag the parameter to document.
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
     * @param paramName the name of the parameter.
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
     * @return the output of the param tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   124
    protected abstract Content paramTagOutput(Element element, DocTree paramTag, String paramName);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
    /**
17572
1081a023532f 8012295: Cleanup JavaFX features in standard doclet
jjg
parents: 17566
diff changeset
   127
     * Return the output for property tags.
1081a023532f 8012295: Cleanup JavaFX features in standard doclet
jjg
parents: 17566
diff changeset
   128
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   129
     * @param element
17572
1081a023532f 8012295: Cleanup JavaFX features in standard doclet
jjg
parents: 17566
diff changeset
   130
     * @param propertyTag the parameter to document.
1081a023532f 8012295: Cleanup JavaFX features in standard doclet
jjg
parents: 17566
diff changeset
   131
     * @param prefix the text with which to prefix the property name.
1081a023532f 8012295: Cleanup JavaFX features in standard doclet
jjg
parents: 17566
diff changeset
   132
     * @return the output of the param tag.
1081a023532f 8012295: Cleanup JavaFX features in standard doclet
jjg
parents: 17566
diff changeset
   133
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   134
    protected abstract Content propertyTagOutput(Element element, DocTree propertyTag, String prefix);
17572
1081a023532f 8012295: Cleanup JavaFX features in standard doclet
jjg
parents: 17566
diff changeset
   135
1081a023532f 8012295: Cleanup JavaFX features in standard doclet
jjg
parents: 17566
diff changeset
   136
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     * Return the return tag output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   139
     * @param element
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     * @param returnTag the return tag to output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     * @return the output of the return tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   143
    protected abstract Content returnTagOutput(Element element, DocTree returnTag);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     * Return the see tag output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   148
     * @param holder
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
     * @param seeTags the array of See tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
     * @return the output of the see tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   152
    protected abstract Content seeTagOutput(Element holder, List<? extends DocTree> seeTags);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
     * Return the output for a simple tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   157
     * @param element
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
     * @param simpleTags the array of simple tags.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   159
     * @param header
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
     * @return the output of the simple tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   162
    protected abstract Content simpleTagOutput(Element element, List<? extends DocTree> simpleTags, String header);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
     * Return the output for a simple tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   167
     * @param element
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     * @param simpleTag the simple tag.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   169
     * @param header
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
     * @return the output of the simple tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   172
    protected abstract Content simpleTagOutput(Element element, DocTree simpleTag, String header);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
     * Return the header for the throws tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
     * @return the header for the throws tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
     */
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   179
    protected abstract Content getThrowsHeader();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
     * Return the header for the throws tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   184
     * @param element
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
     * @param throwsTag the throws tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
     * @return the output of the throws tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   188
    protected abstract Content throwsTagOutput(Element element, DocTree throwsTag);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
     * Return the output for the throws tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
     * @param throwsType the throws type.
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     * @return the output of the throws type.
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   196
    protected abstract Content throwsTagOutput(TypeMirror throwsType);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
     * Return the output for the value tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
     * @param field       the constant field that holds the value tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
     * @param constantVal the constant value to document.
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
     * @param includeLink true if we should link the constant text to the
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     *                    constant field itself.
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
     * @return the output of the value tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   207
    protected abstract Content valueTagOutput(VariableElement field,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
        String constantVal, boolean includeLink);
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
     * Given an output object, append to it the tag documentation for
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
     * the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
     * @param tagletManager the manager that manages the taglets.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   215
     * @param element the Doc that we are print tags for.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
     * @param taglets the taglets to print.
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
     * @param writer the writer that will generate the output strings.
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
     * @param output the output buffer to store the output in.
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   220
    public static void genTagOutput(TagletManager tagletManager, Element element,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   221
            List<Taglet> taglets, TagletWriter writer, Content output) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   222
        Utils utils = writer.configuration().utils;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   223
        tagletManager.checkTags(utils, element, utils.getBlockTags(element), false);
41452
ddaef4bba083 8165991: Fix DocTreeFactory newDocCommentTree
ksrini
parents: 40303
diff changeset
   224
        tagletManager.checkTags(utils, element, utils.getFullBody(element), true);
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17574
diff changeset
   225
        for (Taglet taglet : taglets) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   226
            if (utils.isTypeElement(element) && taglet instanceof ParamTaglet) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
                //The type parameters are documented in a special section away
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
                //from the tag info, so skip here.
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
                continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
            }
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17574
diff changeset
   231
            if (taglet instanceof DeprecatedTaglet) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
                //Deprecated information is documented "inline", not in tag info
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
                //section.
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
                continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   236
            Content currentOutput = null;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
            try {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   238
                currentOutput = taglet.getTagletOutput(element, writer);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   239
            } catch (UnsupportedTagletOperationException utoe) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
                //The taglet does not take a member as an argument.  Let's try
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
                //a single tag.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   242
                List<? extends DocTree> tags = utils.getBlockTags(element, taglet.getName());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   243
                if (!tags.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   244
                    currentOutput = taglet.getTagletOutput(element, tags.get(0), writer);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
            if (currentOutput != null) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17574
diff changeset
   248
                tagletManager.seenCustomTag(taglet.getName());
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   249
                output.addContent(currentOutput);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
     * Given an inline tag, return its output.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   255
     * @param holder
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
     * @param tagletManager The taglet manager for the current doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
     * @param holderTag The tag this holds this inline tag.  Null if there
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
     * is no tag that holds it.
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
     * @param inlineTag The inline tag to be documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
     * @param tagletWriter The taglet writer to write the output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
     * @return The output of the inline tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   263
    public static Content getInlineTagOutput(Element holder, TagletManager tagletManager,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   264
            DocTree holderTag, DocTree inlineTag, TagletWriter tagletWriter) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   265
        List<Taglet> definedTags = tagletManager.getInlineCustomTaglets();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   266
        CommentHelper ch = tagletWriter.configuration().utils.getCommentHelper(holder);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   267
        final String inlineTagName = ch.getTagName(inlineTag);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
        //This is a custom inline tag.
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17574
diff changeset
   269
        for (Taglet definedTag : definedTags) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   270
            if ((definedTag.getName()).equals(inlineTagName)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   271
                // Given a name of a seen custom tag, remove it from the
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
                // set of unseen custom tags.
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17574
diff changeset
   273
                tagletManager.seenCustomTag(definedTag.getName());
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   274
                Content output = definedTag.getTagletOutput(holder,
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17574
diff changeset
   275
                        holderTag != null &&
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17574
diff changeset
   276
                        definedTag.getName().equals("inheritDoc") ?
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17574
diff changeset
   277
                        holderTag : inlineTag, tagletWriter);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
                return output;
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
        return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
     * Converts inline tags and text to TagOutput, expanding the
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
     * inline tags along the way.  Called wherever text can contain
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
     * an inline tag, such as in comments or in free-form text arguments
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
     * to non-inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
     * @param holderTag the tag that holds the documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
     * @param tags   array of text tags and inline tags (often alternating)
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
     *               present in the text of interest for this doc.
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   293
     * @return the {@link Content} representing the comments.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   295
    public abstract Content commentTagsToOutput(DocTree holderTag, List<? extends DocTree> tags);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
     * Converts inline tags and text to TagOutput, expanding the
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
     * inline tags along the way.  Called wherever text can contain
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
     * an inline tag, such as in comments or in free-form text arguments
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
     * to non-inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   303
     * @param holder the element where comment resides.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
     * @param tags   array of text tags and inline tags (often alternating)
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
     *               present in the text of interest for this doc.
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   306
     * @return the {@link Content} representing the comments.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   308
    public abstract Content commentTagsToOutput(Element holder, List<? extends DocTree> tags);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
     * Converts inline tags and text to TagOutput, expanding the
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
     * inline tags along the way.  Called wherever text can contain
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
     * an inline tag, such as in comments or in free-form text arguments
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
     * to non-inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
     * @param holderTag the tag that holds the documentation.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   317
     * @param holder the element where comment resides.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
     * @param tags   array of text tags and inline tags (often alternating)
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
     *               present in the text of interest for this doc.
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
     * @param isFirstSentence true if this is the first sentence.
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   321
     * @return the {@link Content} representing the comments.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   323
    public abstract Content commentTagsToOutput(DocTree holderTag,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   324
        Element holder, List<? extends DocTree> tags, boolean isFirstSentence);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
     * @return an instance of the configuration used for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
     */
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 41452
diff changeset
   329
    public abstract BaseConfiguration configuration();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
}