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
24
25
26
27
28
29
30
31
32
33
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 }