src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/Taglet.java

Wed, 10 Oct 2012 16:48:21 -0700

author
jjg
date
Wed, 10 Oct 2012 16:48:21 -0700
changeset 1359
25e14ad23cef
parent 554
9d9f26857129
child 1743
6a5288a298fd
permissions
-rw-r--r--

8000665: fix "internal API" comments on javadoc files
Reviewed-by: darcy

duke@1 1 /*
ohair@554 2 * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@554 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@554 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@554 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 * or visit www.oracle.com if you need additional information or have any
ohair@554 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.tools.doclets.internal.toolkit.taglets;
duke@1 27
duke@1 28 import com.sun.javadoc.*;
duke@1 29
duke@1 30 /**
duke@1 31 * The interface for a custom tag used by Doclets. A custom
duke@1 32 * tag must implement this interface. To be loaded and used by
duke@1 33 * doclets at run-time, the taglet must have a static method called
duke@1 34 * <code>register</code> that accepts a {@link java.util.Map} as an
duke@1 35 * argument with the following signature:
duke@1 36 * <pre>
duke@1 37 * public void register(Map map)
duke@1 38 * </pre>
duke@1 39 * This method should add an instance of the custom taglet to the map
duke@1 40 * with the name of the taglet as the key. If overriding a taglet,
duke@1 41 * to avoid a name conflict, the overridden taglet must be deleted from
duke@1 42 * the map before an instance of the new taglet is added to the map.
duke@1 43 * <p>
duke@1 44 * It is recommended that the taglet throw an exception when it fails
duke@1 45 * to register itself. The exception that it throws is up to the user.
duke@1 46 * <p>
duke@1 47 * Here are two sample taglets: <br>
duke@1 48 * <ul>
duke@1 49 * <li><a href="{@docRoot}/ToDoTaglet.java">ToDoTaglet.java</a>
duke@1 50 * - Standalone taglet</li>
duke@1 51 * <li><a href="{@docRoot}/UnderlineTaglet.java">UnderlineTaglet.java</a>
duke@1 52 * - Inline taglet</li>
duke@1 53 * </ul>
duke@1 54 * <p>
duke@1 55 * For more information on how to create your own Taglets, please see the
duke@1 56 * <a href="{@docRoot}/overview.html">Taglet Overview</a>.
duke@1 57 *
duke@1 58 * @since 1.4
duke@1 59 * @author Jamie Ho
duke@1 60 */
duke@1 61
duke@1 62 public interface Taglet {
duke@1 63
duke@1 64 /**
duke@1 65 * Return true if this <code>Taglet</code>
duke@1 66 * is used in field documentation.
duke@1 67 * @return true if this <code>Taglet</code>
duke@1 68 * is used in field documentation and false
duke@1 69 * otherwise.
duke@1 70 */
duke@1 71 public abstract boolean inField();
duke@1 72
duke@1 73 /**
duke@1 74 * Return true if this <code>Taglet</code>
duke@1 75 * is used in constructor documentation.
duke@1 76 * @return true if this <code>Taglet</code>
duke@1 77 * is used in constructor documentation and false
duke@1 78 * otherwise.
duke@1 79 */
duke@1 80 public abstract boolean inConstructor();
duke@1 81
duke@1 82 /**
duke@1 83 * Return true if this <code>Taglet</code>
duke@1 84 * is used in method documentation.
duke@1 85 * @return true if this <code>Taglet</code>
duke@1 86 * is used in method documentation and false
duke@1 87 * otherwise.
duke@1 88 */
duke@1 89 public abstract boolean inMethod();
duke@1 90
duke@1 91 /**
duke@1 92 * Return true if this <code>Taglet</code>
duke@1 93 * is used in overview documentation.
duke@1 94 * @return true if this <code>Taglet</code>
duke@1 95 * is used in method documentation and false
duke@1 96 * otherwise.
duke@1 97 */
duke@1 98 public abstract boolean inOverview();
duke@1 99
duke@1 100 /**
duke@1 101 * Return true if this <code>Taglet</code>
duke@1 102 * is used in package documentation.
duke@1 103 * @return true if this <code>Taglet</code>
duke@1 104 * is used in package documentation and false
duke@1 105 * otherwise.
duke@1 106 */
duke@1 107 public abstract boolean inPackage();
duke@1 108
duke@1 109 /**
duke@1 110 * Return true if this <code>Taglet</code>
duke@1 111 * is used in type documentation (classes or
duke@1 112 * interfaces).
duke@1 113 * @return true if this <code>Taglet</code>
duke@1 114 * is used in type documentation and false
duke@1 115 * otherwise.
duke@1 116 */
duke@1 117 public abstract boolean inType();
duke@1 118
duke@1 119 /**
duke@1 120 * Return true if this <code>Taglet</code>
duke@1 121 * is an inline tag. Return false otherwise.
duke@1 122 * @return true if this <code>Taglet</code>
duke@1 123 * is an inline tag and false otherwise.
duke@1 124 */
duke@1 125 public abstract boolean isInlineTag();
duke@1 126
duke@1 127 /**
duke@1 128 * Return the name of this custom tag.
duke@1 129 * @return the name of this custom tag.
duke@1 130 */
duke@1 131 public abstract String getName();
duke@1 132
duke@1 133 /**
duke@1 134 * Given the <code>Tag</code> representation of this custom
duke@1 135 * tag, return its TagletOutput representation, which is output
duke@1 136 * to the generated page.
duke@1 137 * @param tag the <code>Tag</code> representation of this custom tag.
duke@1 138 * @param writer a {@link TagletWriter} Taglet writer.
duke@1 139 * @throws IllegalArgumentException thrown when the method is not supported by the taglet.
duke@1 140 * @return the TagletOutput representation of this <code>Tag</code>.
duke@1 141 */
duke@1 142 public abstract TagletOutput getTagletOutput(Tag tag, TagletWriter writer) throws IllegalArgumentException;
duke@1 143
duke@1 144 /**
duke@1 145 * Given a <code>Doc</code> object, check if it holds any tags of
duke@1 146 * this type. If it does, return the string representing the output.
duke@1 147 * If it does not, return null.
duke@1 148 * @param holder a {@link Doc} object holding the custom tag.
duke@1 149 * @param writer a {@link TagletWriter} Taglet writer.
duke@1 150 * @throws IllegalArgumentException thrown when the method is not supported by the taglet.
duke@1 151 * @return the TagletOutput representation of this <code>Tag</code>.
duke@1 152 */
duke@1 153 public abstract TagletOutput getTagletOutput(Doc holder, TagletWriter writer) throws IllegalArgumentException;
duke@1 154
duke@1 155 }

mercurial