test/com/sun/javadoc/testLegacyTaglet/UnderlineTaglet.java

Tue, 28 Dec 2010 15:54:52 -0800

author
ohair
date
Tue, 28 Dec 2010 15:54:52 -0800
changeset 798
4868a36f6fd8
parent 554
9d9f26857129
child 2525
2eb010b6cb22
permissions
-rw-r--r--

6962318: Update copyright year
Reviewed-by: xdono

     1 /*
     2  * Copyright (c) 2003, 2007, Oracle and/or its affiliates. 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.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  */
    24 import com.sun.tools.doclets.Taglet;
    25 import com.sun.javadoc.*;
    26 import java.util.Map;
    28 /**
    29  * A sample Inline Taglet representing {@underline ...}. This tag can be used in any kind of
    30  * {@link com.sun.javadoc.Doc}.  The text is simple underlined.  For
    31  * example, "@underline UNDERLINE ME" would be shown as: <u>UNDERLINE ME</u>.
    32  *
    33  * @author Jamie Ho
    34  * @since 1.4
    35  */
    37 public class UnderlineTaglet implements Taglet {
    39     private String NAME = "underline";
    41     /**
    42      * Return the name of this custom tag.
    43      */
    44     public String getName() {
    45         return NAME;
    46     }
    48     /**
    49      * Will return false since this is an inline tag.
    50      * @return false since this is an inline tag.
    51      */
    52     public boolean inField() {
    53         return false;
    54     }
    56     /**
    57      * Will return false since this is an inline tag.
    58      * @return false since this is an inline tag.
    59      */
    60     public boolean inConstructor() {
    61         return true;
    62     }
    64     /**
    65      * Will return false since this is an inline tag.
    66      * @return false since this is an inline tag.
    67      */
    68     public boolean inMethod() {
    69         return false;
    70     }
    72     /**
    73      * Will return false since this is an inline tag.
    74      * @return false since this is an inline tag.
    75      */
    76     public boolean inOverview() {
    77         return false;
    78     }
    80     /**
    81      * Will return false since this is an inline tag.
    82      * @return false since this is an inline tag.
    83      */
    84     public boolean inPackage() {
    85         return false;
    86     }
    88     /**
    89      * Will return false since this is an inline tag.
    90      * @return false since this is an inline tag.
    91      */
    92     public boolean inType() {
    93         return false;
    94     }
    96     /**
    97      * Will return true since this is an inline tag.
    98      * @return true since this is an inline tag.
    99      */
   101     public boolean isInlineTag() {
   102         return true;
   103     }
   105     /**
   106      * Register this Taglet.
   107      * @param tagletMap  the map to register this tag to.
   108      */
   109     public static void register(Map tagletMap) {
   110        UnderlineTaglet tag = new UnderlineTaglet();
   111        Taglet t = (Taglet) tagletMap.get(tag.getName());
   112        if (t != null) {
   113            tagletMap.remove(tag.getName());
   114        }
   115        tagletMap.put(tag.getName(), tag);
   116     }
   118     /**
   119      * Given the <code>Tag</code> representation of this custom
   120      * tag, return its string representation.
   121      * @param tag he <code>Tag</code> representation of this custom tag.
   122      */
   123     public String toString(Tag tag) {
   124         return "<u>" + tag.text() + "</u>";
   125     }
   127     /**
   128      * This method should not be called since arrays of inline tags do not
   129      * exist.  Method {@link #tostring(Tag)} should be used to convert this
   130      * inline tag to a string.
   131      * @param tags the array of <code>Tag</code>s representing of this custom tag.
   132      */
   133     public String toString(Tag[] tags) {
   134         return null;
   135     }
   136 }

mercurial