1
2
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
27
28
29
30
31
32
33
34
35
36
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 }