001: /*
002: * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package com.sun.tools.doclets.internal.toolkit.taglets;
027:
028: import com.sun.tools.doclets.internal.toolkit.util.*;
029: import com.sun.javadoc.*;
030:
031: /**
032: * An abstract class for that implements the {@link Taglet} interface.
033: *
034: * This code is not part of an API.
035: * It is implementation that is subject to change.
036: * Do not use it as an API
037: *
038: * @author Jamie Ho
039: * @since 1.4
040: */
041: public abstract class BaseTaglet implements Taglet {
042:
043: protected String name = "Default";
044:
045: /**
046: * Return true if this <code>Taglet</code>
047: * is used in constructor documentation.
048: * @return true if this <code>Taglet</code>
049: * is used in constructor documentation and false
050: * otherwise.
051: */
052: public boolean inConstructor() {
053: return true;
054: }
055:
056: /**
057: * Return true if this <code>Taglet</code>
058: * is used in field documentation.
059: * @return true if this <code>Taglet</code>
060: * is used in field documentation and false
061: * otherwise.
062: */
063: public boolean inField() {
064: return true;
065: }
066:
067: /**
068: * Return true if this <code>Taglet</code>
069: * is used in method documentation.
070: * @return true if this <code>Taglet</code>
071: * is used in method documentation and false
072: * otherwise.
073: */
074: public boolean inMethod() {
075: return true;
076: }
077:
078: /**
079: * Return true if this <code>Taglet</code>
080: * is used in overview documentation.
081: * @return true if this <code>Taglet</code>
082: * is used in method documentation and false
083: * otherwise.
084: */
085: public boolean inOverview() {
086: return true;
087: }
088:
089: /**
090: * Return true if this <code>Taglet</code>
091: * is used in package documentation.
092: * @return true if this <code>Taglet</code>
093: * is used in package documentation and false
094: * otherwise.
095: */
096: public boolean inPackage() {
097: return true;
098: }
099:
100: /**
101: * Return true if this <code>Taglet</code>
102: * is used in type documentation (classes or interfaces).
103: * @return true if this <code>Taglet</code>
104: * is used in type documentation and false
105: * otherwise.
106: */
107: public boolean inType() {
108: return true;
109: }
110:
111: /**
112: * Return true if this <code>Taglet</code>
113: * is an inline tag.
114: * @return true if this <code>Taglet</code>
115: * is an inline tag and false otherwise.
116: */
117: public boolean isInlineTag() {
118: return false;
119: }
120:
121: /**
122: * Return the name of this custom tag.
123: * @return the name of this custom tag.
124: */
125: public String getName() {
126: return name;
127: }
128:
129: /**
130: * {@inheritDoc}
131: * @throws IllegalArgumentException thrown when the method is not supported by the taglet.
132: */
133: public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {
134: throw new IllegalArgumentException(
135: "Method not supported in taglet " + getName() + ".");
136: }
137:
138: /**
139: * {@inheritDoc}
140: * @throws IllegalArgumentException thrown when the method is not supported by the taglet.
141: */
142: public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) {
143: throw new IllegalArgumentException(
144: "Method not supported in taglet " + getName() + ".");
145: }
146: }
|