View Javadoc

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