aoqi@0: /* aoqi@0: * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: import com.sun.tools.doclets.Taglet; aoqi@0: import com.sun.javadoc.*; aoqi@0: import java.util.Map; aoqi@0: aoqi@0: /** aoqi@0: * A sample Inline Taglet representing {@underline ...}. This tag can be used in any kind of aoqi@0: * {@link com.sun.javadoc.Doc}. The text is simple underlined. For aoqi@0: * example, "@underline UNDERLINE ME" would be shown as: UNDERLINE ME. aoqi@0: * aoqi@0: * @author Jamie Ho aoqi@0: * @since 1.4 aoqi@0: */ aoqi@0: aoqi@0: public class UnderlineTaglet implements Taglet { aoqi@0: aoqi@0: private String NAME = "underline"; aoqi@0: aoqi@0: /** aoqi@0: * Return the name of this custom tag. aoqi@0: */ aoqi@0: public String getName() { aoqi@0: return NAME; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Will return false since this is an inline tag. aoqi@0: * @return false since this is an inline tag. aoqi@0: */ aoqi@0: public boolean inField() { aoqi@0: return false; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Will return false since this is an inline tag. aoqi@0: * @return false since this is an inline tag. aoqi@0: */ aoqi@0: public boolean inConstructor() { aoqi@0: return true; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Will return false since this is an inline tag. aoqi@0: * @return false since this is an inline tag. aoqi@0: */ aoqi@0: public boolean inMethod() { aoqi@0: return false; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Will return false since this is an inline tag. aoqi@0: * @return false since this is an inline tag. aoqi@0: */ aoqi@0: public boolean inOverview() { aoqi@0: return false; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Will return false since this is an inline tag. aoqi@0: * @return false since this is an inline tag. aoqi@0: */ aoqi@0: public boolean inPackage() { aoqi@0: return false; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Will return false since this is an inline tag. aoqi@0: * @return false since this is an inline tag. aoqi@0: */ aoqi@0: public boolean inType() { aoqi@0: return false; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Will return true since this is an inline tag. aoqi@0: * @return true since this is an inline tag. aoqi@0: */ aoqi@0: aoqi@0: public boolean isInlineTag() { aoqi@0: return true; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Register this Taglet. aoqi@0: * @param tagletMap the map to register this tag to. aoqi@0: */ aoqi@0: public static void register(Map tagletMap) { aoqi@0: UnderlineTaglet tag = new UnderlineTaglet(); aoqi@0: Taglet t = (Taglet) tagletMap.get(tag.getName()); aoqi@0: if (t != null) { aoqi@0: tagletMap.remove(tag.getName()); aoqi@0: } aoqi@0: tagletMap.put(tag.getName(), tag); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Given the Tag representation of this custom aoqi@0: * tag, return its string representation. aoqi@0: * @param tag he Tag representation of this custom tag. aoqi@0: */ aoqi@0: public String toString(Tag tag) { aoqi@0: return "" + tag.text() + ""; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * This method should not be called since arrays of inline tags do not aoqi@0: * exist. Method {@link #tostring(Tag)} should be used to convert this aoqi@0: * inline tag to a string. aoqi@0: * @param tags the array of Tags representing of this custom tag. aoqi@0: */ aoqi@0: public String toString(Tag[] tags) { aoqi@0: return null; aoqi@0: } aoqi@0: }