001/*license*\ 002 Codelet: Copyright (C) 2014, Jeff Epstein (aliteralmind __DASH__ github __AT__ yahoo __DOT__ com) 003 004 This software is dual-licensed under the: 005 - Lesser General Public License (LGPL) version 3.0 or, at your option, any later version; 006 - Apache Software License (ASL) version 2.0. 007 008 Either license may be applied at your discretion. More information may be found at 009 - http://en.wikipedia.org/wiki/Multi-licensing. 010 011 The text of both licenses is available in the root directory of this project, under the names "LICENSE_lgpl-3.0.txt" and "LICENSE_asl-2.0.txt". The latest copies may be downloaded at: 012 - LGPL 3.0: https://www.gnu.org/licenses/lgpl-3.0.txt 013 - ASL 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt 014\*license*/ 015package com.github.aliteralmind.codelet.taglet; 016 import com.github.aliteralmind.codelet.CodeletBootstrap; 017 import com.github.aliteralmind.codelet.CodeletType; 018 import com.sun.javadoc.Tag; 019 import com.sun.tools.doclets.Taglet; 020 import java.util.Map; 021 022/** 023 <p>Inline JavaDoc taglet for displaying the console (<code>{@link java.lang.System System}.{@link java.lang.System#out out}</code>) output for a class (usually example code). This tag can be used in any kind of {@link com.sun.javadoc.Doc}.</p> 024 025 <p>The only custom code in this class is the {@link #NAME} field and {@link #toString(Tag) toString} function.</p> 026 027 <p>Jamie Ho's <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/taglet/overview.html#inlineexample">UnderlineTaglet</a> was the template used to create this file.</p> 028 029 * @since 0.1.0 030 * @author Copyright (C) 2014, Jeff Epstein ({@code aliteralmind __DASH__ github __AT__ yahoo __DOT__ com}), dual-licensed under the LGPL (version 3.0 or later) or the ASL (version 2.0). See source code for details. <a href="http://codelet.aliteralmind.com">{@code http://codelet.aliteralmind.com}</a>, <a href="https://github.com/aliteralmind/codelet">{@code https://github.com/aliteralmind/codelet}</a>. 031 **/ 032public class CodeletDotOutTaglet implements Taglet { 033 /* 034 To avoid configuration from being loaded repeatedly. 035 */ 036 private static final CodeletBootstrap BOOTSTRAP = CodeletBootstrap.INSTANCE; 037 /** 038 <p>The name of this taglet, which appears immediately after the <code>{@</code>--Equal to 039 <br/> <code>{@link com.github.aliteralmind.codelet.CodeletType CodeletType}.{@link com.github.aliteralmind.codelet.CodeletType#CONSOLE_OUT CONSOLE_OUT}.{@link com.github.aliteralmind.codelet.CodeletType#getName() getName}()</code></p> 040 */ 041 public static final String NAME = CodeletType.CONSOLE_OUT.getName(); 042 043 /** 044 * Return the name of this custom tag. 045 046 @return #NAME 047 */ 048 public String getName() { 049 return NAME; 050 } 051 052 /** 053 * @return true since this tag can be used in a field 054 * doc comment 055 */ 056 public boolean inField() { 057 return true; 058 } 059 060 /** 061 * @return true since this tag can be used in a constructor 062 * doc comment 063 */ 064 public boolean inConstructor() { 065 return true; 066 } 067 068 /** 069 * @return true since this tag can be used in a method 070 * doc comment 071 */ 072 public boolean inMethod() { 073 return true; 074 } 075 076 /** 077 * @return true since this tag can be used in an overview 078 * doc comment 079 */ 080 public boolean inOverview() { 081 return true; 082 } 083 084 /** 085 * @return true since this tag can be used in a package 086 * doc comment 087 */ 088 public boolean inPackage() { 089 return true; 090 } 091 092 /** 093 * @return true since this 094 */ 095 public boolean inType() { 096 return false; 097 } 098 099 /** 100 * Will return true since this is an inline tag. 101 * @return true since this is an inline tag. 102 */ 103 104 public boolean isInlineTag() { 105 return true; 106 } 107 /** 108 <p>Register this Taglet.</p> 109 110 * <p>Equal to 111 <br/> <code>{@link ComSunJavaDocUtil}.{@link ComSunJavaDocUtil#registerNewTagletInstance(Taglet, Map) registerNewTagletInstance}(new {@link #CodeletDotOutTaglet() CodeletDotOutTaglet}(), taglet_map)</code></p> 112 */ 113 @SuppressWarnings({"unchecked", "rawtypes"}) 114 public static void register(Map taglet_map) { 115 ComSunJavaDocUtil.registerNewTagletInstance(new CodeletDotOutTaglet(), taglet_map); 116 } 117 /** 118 * Given the <code>Tag</code> representation of this custom 119 * tag, return its string representation. 120 * @param tag The <code>Tag</code> representation of this custom tag. 121 * @return <code>{@link com.github.aliteralmind.codelet.taglet.CodletComSunJavadocTagProcessor CodletComSunJavadocTagProcessor}.{@link com.github.aliteralmind.codelet.taglet.CodletComSunJavadocTagProcessor#get(Tag) get}(tag)</code> 122 */ 123 public String toString(Tag tag) { 124 return CodletComSunJavadocTagProcessor.get(tag); 125 } 126 127 /** 128 * This method should not be called since arrays of inline tags do not 129 * exist. Method {@link #toString(Tag)} should be used to convert this 130 * inline tag to a string. 131 * @param tags the array of <code>Tag</code>s representing of this custom tag. 132 */ 133 public String toString(Tag[] tags) { 134 return null; 135 } 136}