View Javadoc

    1   package net.sourceforge.pmd.lang.java.javadoc;
    2
    3   import java.util.HashMap;
    4   import java.util.Map;
    5   import java.util.Set;
    6
    7   public final class JavadocTag {
    8
    9   	public final String label;
    10  	public final String description;
    11
    12  	private static final Map<String, JavadocTag> tagsById = new HashMap<String, JavadocTag>();
    13
    14  	public static final JavadocTag AUTHOR  		= new JavadocTag("author", 	"Authors of the source code, in chronological order");
    15  	public static final JavadocTag SINCE		= new JavadocTag("since", 	"Version of the source code that this item was introduced, can be a number or a date");
    16  	public static final JavadocTag VERSION  	= new JavadocTag("version", "Current version number of the source code");
    17  	public static final JavadocTag DEPRECATED	= new JavadocTag("deprecated", "Indicates that an item is a member of the deprecated API");
    18  	public static final JavadocTag PARAM  		= new JavadocTag("param", 	" ");
    19  	public static final JavadocTag THROWS  		= new JavadocTag("throws", 	" ");
    20  	public static final JavadocTag RETURN  		= new JavadocTag("returns", " ");
    21  	public static final JavadocTag SEE  		= new JavadocTag("see", 	" ");
    22
    23  /*	public static final JavadocTag POST  		= new JavadocTag("post", 	" ");
    24  	public static final JavadocTag PRE  		= new JavadocTag("pre", 	" ");
    25  	public static final JavadocTag RETURN  		= new JavadocTag("return", 	" ");
    26  	public static final JavadocTag INV  		= new JavadocTag("inv", 	" ");
    27  	public static final JavadocTag INVARIANT  	= new JavadocTag("invariant", 	" ");
    28  	public static final JavadocTag PATTERN  	= new JavadocTag("pattern", 	" ");
    29  	public static final JavadocTag SERIAL  		= new JavadocTag("serial", 	" ");
    30  	public static final JavadocTag SERIAL_DATA	= new JavadocTag("serialData", 	" ");
    31  	public static final JavadocTag SERIAL_FIELD	= new JavadocTag("serialField", 	" ");
    32  	public static final JavadocTag GENERATED  	= new JavadocTag("generated", 	" ");
    33  	public static final JavadocTag GENERATED_BY	= new JavadocTag("generatedBy", 	" ");  */
    34
    35  	private JavadocTag(String theLabel, String theDescription) {
    36  		label = theLabel;
    37  		description = theDescription;
    38
    39  		if (tagsById.containsKey(theLabel)) {
    40  			throw new IllegalArgumentException("pre-existing tag!");
    41  		}
    42
    43  		tagsById.put(theLabel, this);
    44  	}
    45
    46  	public static JavadocTag tagFor(String id) {
    47  		return tagsById.get(id);
    48  	}
    49
    50  	public static Set<String> allTagIds() {
    51  		return tagsById.keySet();
    52  	}
    53  }