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

changeset 0
959103a6100f
child 2525
2eb010b6cb22
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/Taglet.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,157 @@
     1.4 +/*
     1.5 + * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package com.sun.tools.doclets;
    1.30 +
    1.31 +import com.sun.javadoc.*;
    1.32 +
    1.33 +/**
    1.34 + * The interface for a custom tag used by Doclets. A custom
    1.35 + * tag must implement this interface.  To be loaded and used by
    1.36 + * doclets at run-time, the taglet must have a static method called
    1.37 + * <code>register</code> that accepts a {@link java.util.Map} as an
    1.38 + * argument with the following signature:
    1.39 + * <pre>
    1.40 + *   public void register(Map map)
    1.41 + * </pre>
    1.42 + * This method should add an instance of the custom taglet to the map
    1.43 + * with the name of the taglet as the key.  If overriding a taglet,
    1.44 + * to avoid a name conflict, the overridden taglet must be deleted from
    1.45 + * the map before an instance of the new taglet is added to the map.
    1.46 + * <p>
    1.47 + * It is recommended that the taglet throw an exception when it fails
    1.48 + * to register itself.  The exception that it throws is up to the user.
    1.49 + * <p>
    1.50 + * Here are two sample taglets: <br>
    1.51 + * <ul>
    1.52 + *  <li><a href="{@docRoot}/../../../../technotes/guides/javadoc/taglet/ToDoTaglet.java">ToDoTaglet.java</a>
    1.53 + *         - Standalone taglet</li>
    1.54 + *  <li><a href="{@docRoot}/../../../../technotes/guides/javadoc/taglet/UnderlineTaglet.java">UnderlineTaglet.java</a>
    1.55 + *         - Inline taglet</li>
    1.56 + * </ul>
    1.57 + * <p>
    1.58 + * For more information on how to create your own Taglets, please see the
    1.59 + * <a href="{@docRoot}/../../../../technotes/guides/javadoc/taglet/overview.html">Taglet Overview</a>.
    1.60 + *
    1.61 + * @since 1.4
    1.62 + * @author Jamie Ho
    1.63 + */
    1.64 +
    1.65 +public interface Taglet {
    1.66 +
    1.67 +    /**
    1.68 +     * Return true if this <code>Taglet</code>
    1.69 +     * is used in field documentation.  Set to
    1.70 +     * false for inline tags.
    1.71 +     * @return true if this <code>Taglet</code>
    1.72 +     * is used in field documentation and false
    1.73 +     * otherwise.
    1.74 +     */
    1.75 +    public abstract boolean inField();
    1.76 +
    1.77 +    /**
    1.78 +     * Return true if this <code>Taglet</code>
    1.79 +     * is used in constructor documentation. Set to
    1.80 +     * false for inline tags.
    1.81 +     * @return true if this <code>Taglet</code>
    1.82 +     * is used in constructor documentation and false
    1.83 +     * otherwise.
    1.84 +     */
    1.85 +    public abstract boolean inConstructor();
    1.86 +
    1.87 +    /**
    1.88 +     * Return true if this <code>Taglet</code>
    1.89 +     * is used in method documentation. Set to
    1.90 +     * false for inline tags.
    1.91 +     * @return true if this <code>Taglet</code>
    1.92 +     * is used in method documentation and false
    1.93 +     * otherwise.
    1.94 +     */
    1.95 +    public abstract boolean inMethod();
    1.96 +
    1.97 +    /**
    1.98 +     * Return true if this <code>Taglet</code>
    1.99 +     * is used in overview documentation. Set to
   1.100 +     * false for inline tags.
   1.101 +     * @return true if this <code>Taglet</code>
   1.102 +     * is used in method documentation and false
   1.103 +     * otherwise.
   1.104 +     */
   1.105 +    public abstract boolean inOverview();
   1.106 +
   1.107 +    /**
   1.108 +     * Return true if this <code>Taglet</code>
   1.109 +     * is used in package documentation. Set to
   1.110 +     * false for inline tags.
   1.111 +     * @return true if this <code>Taglet</code>
   1.112 +     * is used in package documentation and false
   1.113 +     * otherwise.
   1.114 +     */
   1.115 +    public abstract boolean inPackage();
   1.116 +
   1.117 +    /**
   1.118 +     * Return true if this <code>Taglet</code>
   1.119 +     * is used in type documentation (classes or
   1.120 +     * interfaces). Set to false for inline tags.
   1.121 +     * @return true if this <code>Taglet</code>
   1.122 +     * is used in type documentation and false
   1.123 +     * otherwise.
   1.124 +     */
   1.125 +    public abstract boolean inType();
   1.126 +
   1.127 +    /**
   1.128 +     * Return true if this <code>Taglet</code>
   1.129 +     * is an inline tag. Return false otherwise.
   1.130 +     * @return true if this <code>Taglet</code>
   1.131 +     * is an inline tag and false otherwise.
   1.132 +     */
   1.133 +    public abstract boolean isInlineTag();
   1.134 +
   1.135 +    /**
   1.136 +     * Return the name of this custom tag.
   1.137 +     * @return the name of this custom tag.
   1.138 +     */
   1.139 +    public abstract String getName();
   1.140 +
   1.141 +    /**
   1.142 +     * Given the <code>Tag</code> representation of this custom
   1.143 +     * tag, return its string representation, which is output
   1.144 +     * to the generated page.
   1.145 +     * @param tag the <code>Tag</code> representation of this custom tag.
   1.146 +     * @return the string representation of this <code>Tag</code>.
   1.147 +     */
   1.148 +    public abstract String toString(Tag tag);
   1.149 +
   1.150 +    /**
   1.151 +     * Given an array of <code>Tag</code>s representing this custom
   1.152 +     * tag, return its string representation, which is output
   1.153 +     * to the generated page.  This method should
   1.154 +     * return null if this taglet represents an inline tag.
   1.155 +     * @param tags the array of <code>Tag</code>s representing of this custom tag.
   1.156 +     * @return the string representation of this <code>Tag</code>.
   1.157 +     */
   1.158 +    public abstract String toString(Tag[] tags);
   1.159 +
   1.160 +}

mercurial