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