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

changeset 1996
7a2fe98cb0e6
child 2147
130b8c0e570e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/com/sun/javadoc/testLegacyTaglet/Check.java	Fri Aug 30 16:16:28 2013 -0700
     1.3 @@ -0,0 +1,143 @@
     1.4 +/*
     1.5 + * Copyright (c) 2013, 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.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + */
    1.26 +
    1.27 +import com.sun.tools.doclets.Taglet;
    1.28 +import com.sun.javadoc.*;
    1.29 +import java.util.Map;
    1.30 +
    1.31 +public class Check implements Taglet {
    1.32 +
    1.33 +    private static final String TAG_NAME = "check";
    1.34 +    private static final String TAG_HEADER = "Check:";
    1.35 +
    1.36 +    /**
    1.37 +     * Return true since the tag can be used in package documentation.
    1.38 +     *
    1.39 +     * @return true since the tag can be used in package documentation.
    1.40 +     */
    1.41 +    public boolean inPackage() {
    1.42 +        return true;
    1.43 +    }
    1.44 +
    1.45 +    /**
    1.46 +     * Return true since the tag can be used in overview documentation.
    1.47 +     *
    1.48 +     * @return true since the tag can be used in overview documentation.
    1.49 +     */
    1.50 +    public boolean inOverview() {
    1.51 +        return true;
    1.52 +    }
    1.53 +
    1.54 +    /**
    1.55 +     * Return true since the tag can be used in type (class/interface)
    1.56 +     * documentation.
    1.57 +     *
    1.58 +     * @return true since the tag can be used in type (class/interface)
    1.59 +     * documentation.
    1.60 +     */
    1.61 +    public boolean inType() {
    1.62 +        return true;
    1.63 +    }
    1.64 +
    1.65 +    /**
    1.66 +     * Return true since the tag can be used in constructor documentation.
    1.67 +     *
    1.68 +     * @return true since the tag can be used in constructor documentation.
    1.69 +     */
    1.70 +    public boolean inConstructor() {
    1.71 +        return true;
    1.72 +    }
    1.73 +
    1.74 +    /**
    1.75 +     * Return true since the tag can be used in field documentation.
    1.76 +     *
    1.77 +     * @return true since the tag can be used in field documentation.
    1.78 +     */
    1.79 +    public boolean inField() {
    1.80 +        return true;
    1.81 +    }
    1.82 +
    1.83 +    /**
    1.84 +     * Return true since the tag can be used in method documentation.
    1.85 +     *
    1.86 +     * @return true since the tag can be used in method documentation.
    1.87 +     */
    1.88 +    public boolean inMethod() {
    1.89 +        return true;
    1.90 +    }
    1.91 +
    1.92 +    /**
    1.93 +     * Return false since the tag is not an inline tag.
    1.94 +     *
    1.95 +     * @return false since the tag is not an inline tag.
    1.96 +     */
    1.97 +    public boolean isInlineTag() {
    1.98 +        return false;
    1.99 +    }
   1.100 +
   1.101 +    /**
   1.102 +     * Register this taglet.
   1.103 +     *
   1.104 +     * @param tagletMap the map to register this tag to.
   1.105 +     */
   1.106 +    @SuppressWarnings("unchecked")
   1.107 +    public static void register(Map tagletMap) {
   1.108 +        Check tag = new Check();
   1.109 +        Taglet t = (Taglet) tagletMap.get(tag.getName());
   1.110 +        if (t != null) {
   1.111 +            tagletMap.remove(tag.getName());
   1.112 +        }
   1.113 +        tagletMap.put(tag.getName(), tag);
   1.114 +    }
   1.115 +
   1.116 +    /**
   1.117 +     * Return the name of this custom tag.
   1.118 +     *
   1.119 +     * @return the name of this tag.
   1.120 +     */
   1.121 +    public String getName() {
   1.122 +        return TAG_NAME;
   1.123 +    }
   1.124 +
   1.125 +    /**
   1.126 +     * Given the tag representation of this custom tag, return its string
   1.127 +     * representation.
   1.128 +     *
   1.129 +     * @param tag the tag representation of this custom tag.
   1.130 +     */
   1.131 +    public String toString(Tag tag) {
   1.132 +        return "<dt><span class=\"strong\">" + TAG_HEADER + ":</span></dt><dd>" + tag.text() +
   1.133 +                "</dd>\n";
   1.134 +    }
   1.135 +
   1.136 +    /**
   1.137 +     * Given an array of tags representing this custom tag, return its string
   1.138 +     * representation.
   1.139 +     *
   1.140 +     * @param tags the array of tags representing of this custom tag.
   1.141 +     * @return null to test if the javadoc throws an exception or not.
   1.142 +     */
   1.143 +    public String toString(Tag[] tags) {
   1.144 +        return null;
   1.145 +    }
   1.146 +}

mercurial