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

Sat, 01 Dec 2007 00:00:00 +0000

author
duke
date
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1
9a66ca7c79fa
child 554
9d9f26857129
permissions
-rw-r--r--

Initial load

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

mercurial