bpatel@1996: /* bpatel@1996: * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. bpatel@1996: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. bpatel@1996: * bpatel@1996: * This code is free software; you can redistribute it and/or modify it bpatel@1996: * under the terms of the GNU General Public License version 2 only, as bpatel@1996: * published by the Free Software Foundation. bpatel@1996: * bpatel@1996: * This code is distributed in the hope that it will be useful, but WITHOUT bpatel@1996: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or bpatel@1996: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License bpatel@1996: * version 2 for more details (a copy is included in the LICENSE file that bpatel@1996: * accompanied this code). bpatel@1996: * bpatel@1996: * You should have received a copy of the GNU General Public License version bpatel@1996: * 2 along with this work; if not, write to the Free Software Foundation, bpatel@1996: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. bpatel@1996: * bpatel@1996: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA bpatel@1996: * or visit www.oracle.com if you need additional information or have any bpatel@1996: * questions. bpatel@1996: */ bpatel@1996: bpatel@1996: import com.sun.tools.doclets.Taglet; bpatel@1996: import com.sun.javadoc.*; bpatel@1996: import java.util.Map; bpatel@1996: bpatel@1996: public class Check implements Taglet { bpatel@1996: bpatel@1996: private static final String TAG_NAME = "check"; bpatel@1996: private static final String TAG_HEADER = "Check:"; bpatel@1996: bpatel@1996: /** bpatel@1996: * Return true since the tag can be used in package documentation. bpatel@1996: * bpatel@1996: * @return true since the tag can be used in package documentation. bpatel@1996: */ bpatel@1996: public boolean inPackage() { bpatel@1996: return true; bpatel@1996: } bpatel@1996: bpatel@1996: /** bpatel@1996: * Return true since the tag can be used in overview documentation. bpatel@1996: * bpatel@1996: * @return true since the tag can be used in overview documentation. bpatel@1996: */ bpatel@1996: public boolean inOverview() { bpatel@1996: return true; bpatel@1996: } bpatel@1996: bpatel@1996: /** bpatel@1996: * Return true since the tag can be used in type (class/interface) bpatel@1996: * documentation. bpatel@1996: * bpatel@1996: * @return true since the tag can be used in type (class/interface) bpatel@1996: * documentation. bpatel@1996: */ bpatel@1996: public boolean inType() { bpatel@1996: return true; bpatel@1996: } bpatel@1996: bpatel@1996: /** bpatel@1996: * Return true since the tag can be used in constructor documentation. bpatel@1996: * bpatel@1996: * @return true since the tag can be used in constructor documentation. bpatel@1996: */ bpatel@1996: public boolean inConstructor() { bpatel@1996: return true; bpatel@1996: } bpatel@1996: bpatel@1996: /** bpatel@1996: * Return true since the tag can be used in field documentation. bpatel@1996: * bpatel@1996: * @return true since the tag can be used in field documentation. bpatel@1996: */ bpatel@1996: public boolean inField() { bpatel@1996: return true; bpatel@1996: } bpatel@1996: bpatel@1996: /** bpatel@1996: * Return true since the tag can be used in method documentation. bpatel@1996: * bpatel@1996: * @return true since the tag can be used in method documentation. bpatel@1996: */ bpatel@1996: public boolean inMethod() { bpatel@1996: return true; bpatel@1996: } bpatel@1996: bpatel@1996: /** bpatel@1996: * Return false since the tag is not an inline tag. bpatel@1996: * bpatel@1996: * @return false since the tag is not an inline tag. bpatel@1996: */ bpatel@1996: public boolean isInlineTag() { bpatel@1996: return false; bpatel@1996: } bpatel@1996: bpatel@1996: /** bpatel@1996: * Register this taglet. bpatel@1996: * bpatel@1996: * @param tagletMap the map to register this tag to. bpatel@1996: */ bpatel@1996: @SuppressWarnings("unchecked") bpatel@1996: public static void register(Map tagletMap) { bpatel@1996: Check tag = new Check(); bpatel@1996: Taglet t = (Taglet) tagletMap.get(tag.getName()); bpatel@1996: if (t != null) { bpatel@1996: tagletMap.remove(tag.getName()); bpatel@1996: } bpatel@1996: tagletMap.put(tag.getName(), tag); bpatel@1996: } bpatel@1996: bpatel@1996: /** bpatel@1996: * Return the name of this custom tag. bpatel@1996: * bpatel@1996: * @return the name of this tag. bpatel@1996: */ bpatel@1996: public String getName() { bpatel@1996: return TAG_NAME; bpatel@1996: } bpatel@1996: bpatel@1996: /** bpatel@1996: * Given the tag representation of this custom tag, return its string bpatel@1996: * representation. bpatel@1996: * bpatel@1996: * @param tag the tag representation of this custom tag. bpatel@1996: */ bpatel@1996: public String toString(Tag tag) { bpatel@1996: return "
" + TAG_HEADER + ":
" + tag.text() + bpatel@1996: "
\n"; bpatel@1996: } bpatel@1996: bpatel@1996: /** bpatel@1996: * Given an array of tags representing this custom tag, return its string bpatel@1996: * representation. bpatel@1996: * bpatel@1996: * @param tags the array of tags representing of this custom tag. bpatel@1996: * @return null to test if the javadoc throws an exception or not. bpatel@1996: */ bpatel@1996: public String toString(Tag[] tags) { bpatel@1996: return null; bpatel@1996: } bpatel@1996: }