⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 todotaglet.java

📁 Jodd是一个开源的公用Java基础类库
💻 JAVA
字号:
package jodd.taglet;import java.util.Map;import com.sun.javadoc.Tag;import com.sun.tools.doclets.Taglet;/** * A sample To Do Taglet. This tag can be used in any kind of {@link * com.sun.javadoc.Doc}. It is not an inline tag. Every generated html text * element has its own CSS "to do" class. */public class ToDoTaglet implements Taglet {		private static final String NAME = "2do";	private static final String HEADER = "To Do:";	private static final String CSS_CLASS = "todo";		/**	 * Return the name of this custom tag.	 */	public String getName() {		return NAME;	}		/**	 * Will return true since <code>@2do</code> can be used in field	 * documentation.	 *	 * @return true since <code>@2do</code> can be used in field documentation and false	 *         otherwise.	 */	public boolean inField() {		return true;	}		/**	 * Will return true since <code>@2do</code> can be used in constructor	 * documentation.	 *	 * @return true since <code>@2do</code> can be used in constructor documentation and	 *         false otherwise.	 */	public boolean inConstructor() {		return true;	}		/**	 * Will return true since <code>@2do</code> can be used in method	 * documentation.	 *	 * @return true since <code>@2do</code> can be used in method documentation and	 *         false otherwise.	 */	public boolean inMethod() {		return true;	}		/**	 * Will return true since <code>@2do</code> can be used in method	 * documentation.	 *	 * @return true since <code>@2do</code> can be used in overview documentation and	 *         false otherwise.	 */	public boolean inOverview() {		return true;	}		/**	 * Will return true since <code>@2do</code> can be used in package	 * documentation.	 *	 * @return true since <code>@2do</code> can be used in package documentation and	 *         false otherwise.	 */	public boolean inPackage() {		return true;	}		/**	 * Will return true since <code>@2do</code> can be used in type	 * documentation (classes or interfaces).	 *	 * @return true since <code>@2do</code> can be used in type documentation and false	 *         otherwise.	 */	public boolean inType() {		return true;	}		/**	 * Will return false since <code>@2do</code> is not an inline tag.	 *	 * @return false since <code>@2do</code> is not an inline tag.	 */	public boolean isInlineTag() {		return false;	}		/**	 * Register this Taglet.	 *	 * @param tagletMap the map to register this tag to.	 */	public static void register(Map tagletMap) {		ToDoTaglet tag = new ToDoTaglet();		Taglet t = (Taglet) tagletMap.get(tag.getName());		if (t != null) {			tagletMap.remove(tag.getName());		}		tagletMap.put(tag.getName(), tag);	}	/**	 * Given the <code>Tag</code> representation of this custom tag, return its	 * string representation.	 *	 * @param tag    the <code>Tag</code> representation of this custom tag.	 */	public String toString(Tag tag) {		return getString(tag.text());	}	/**	 * Given an array of <code>Tag</code>s representing this custom tag, return	 * its string representation.	 *	 * @param tags   the array of <code>Tag</code>s representing of this custom tag.	 */	public String toString(Tag[] tags) {		if (tags.length == 0) {			return null;		}		String result = new String();		for (int i = 0; i < tags.length; i++) {			if (i > 0) {				result += "</dd>\n<dd class=\"" + CSS_CLASS + "\">";			}			result += tags[i].text();		}		return getString(result);	}	/**	 * Formats the output.	 *	 * @param tagtext	 */	private String getString(String tagtext) {		String result = "\n<dt class=\"" + CSS_CLASS + "\">" + HEADER;		result += "<dd class=\"" + CSS_CLASS + "\">";		result += "<span class=\"" + CSS_CLASS + "\">";		result += tagtext;		result += "</span></dd></dt>\n";		return result;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -