src/share/classes/com/sun/tools/doclets/Taglet.java

Tue, 25 May 2010 15:54:51 -0700

author
ohair
date
Tue, 25 May 2010 15:54:51 -0700
changeset 554
9d9f26857129
parent 1
9a66ca7c79fa
child 2525
2eb010b6cb22
permissions
-rw-r--r--

6943119: Rebrand source copyright notices
Reviewed-by: darcy

duke@1 1 /*
ohair@554 2 * Copyright (c) 2001, 2006, 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;
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}/../../../../technotes/guides/javadoc/taglet/ToDoTaglet.java">ToDoTaglet.java</a>
duke@1 50 * - Standalone taglet</li>
duke@1 51 * <li><a href="{@docRoot}/../../../../technotes/guides/javadoc/taglet/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}/../../../../technotes/guides/javadoc/taglet/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. Set to
duke@1 67 * false for inline tags.
duke@1 68 * @return true if this <code>Taglet</code>
duke@1 69 * is used in field documentation and false
duke@1 70 * otherwise.
duke@1 71 */
duke@1 72 public abstract boolean inField();
duke@1 73
duke@1 74 /**
duke@1 75 * Return true if this <code>Taglet</code>
duke@1 76 * is used in constructor documentation. Set to
duke@1 77 * false for inline tags.
duke@1 78 * @return true if this <code>Taglet</code>
duke@1 79 * is used in constructor documentation and false
duke@1 80 * otherwise.
duke@1 81 */
duke@1 82 public abstract boolean inConstructor();
duke@1 83
duke@1 84 /**
duke@1 85 * Return true if this <code>Taglet</code>
duke@1 86 * is used in method documentation. Set to
duke@1 87 * false for inline tags.
duke@1 88 * @return true if this <code>Taglet</code>
duke@1 89 * is used in method documentation and false
duke@1 90 * otherwise.
duke@1 91 */
duke@1 92 public abstract boolean inMethod();
duke@1 93
duke@1 94 /**
duke@1 95 * Return true if this <code>Taglet</code>
duke@1 96 * is used in overview documentation. Set to
duke@1 97 * false for inline tags.
duke@1 98 * @return true if this <code>Taglet</code>
duke@1 99 * is used in method documentation and false
duke@1 100 * otherwise.
duke@1 101 */
duke@1 102 public abstract boolean inOverview();
duke@1 103
duke@1 104 /**
duke@1 105 * Return true if this <code>Taglet</code>
duke@1 106 * is used in package documentation. Set to
duke@1 107 * false for inline tags.
duke@1 108 * @return true if this <code>Taglet</code>
duke@1 109 * is used in package documentation and false
duke@1 110 * otherwise.
duke@1 111 */
duke@1 112 public abstract boolean inPackage();
duke@1 113
duke@1 114 /**
duke@1 115 * Return true if this <code>Taglet</code>
duke@1 116 * is used in type documentation (classes or
duke@1 117 * interfaces). Set to false for inline tags.
duke@1 118 * @return true if this <code>Taglet</code>
duke@1 119 * is used in type documentation and false
duke@1 120 * otherwise.
duke@1 121 */
duke@1 122 public abstract boolean inType();
duke@1 123
duke@1 124 /**
duke@1 125 * Return true if this <code>Taglet</code>
duke@1 126 * is an inline tag. Return false otherwise.
duke@1 127 * @return true if this <code>Taglet</code>
duke@1 128 * is an inline tag and false otherwise.
duke@1 129 */
duke@1 130 public abstract boolean isInlineTag();
duke@1 131
duke@1 132 /**
duke@1 133 * Return the name of this custom tag.
duke@1 134 * @return the name of this custom tag.
duke@1 135 */
duke@1 136 public abstract String getName();
duke@1 137
duke@1 138 /**
duke@1 139 * Given the <code>Tag</code> representation of this custom
duke@1 140 * tag, return its string representation, which is output
duke@1 141 * to the generated page.
duke@1 142 * @param tag the <code>Tag</code> representation of this custom tag.
duke@1 143 * @return the string representation of this <code>Tag</code>.
duke@1 144 */
duke@1 145 public abstract String toString(Tag tag);
duke@1 146
duke@1 147 /**
duke@1 148 * Given an array of <code>Tag</code>s representing this custom
duke@1 149 * tag, return its string representation, which is output
duke@1 150 * to the generated page. This method should
duke@1 151 * return null if this taglet represents an inline tag.
duke@1 152 * @param tags the array of <code>Tag</code>s representing of this custom tag.
duke@1 153 * @return the string representation of this <code>Tag</code>.
duke@1 154 */
duke@1 155 public abstract String toString(Tag[] tags);
duke@1 156
duke@1 157 }

mercurial