1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package net.sf.clirr.core;
21
22 /***
23 * Class which manages API Difference messages, including expanding message
24 * codes into strings and descriptions.
25 */
26 public final class Message
27 {
28 private int id;
29
30 /***
31 * This constructor is equivalent to new Message(id, true).
32 */
33 public Message(int id)
34 {
35 this(id, true);
36 }
37
38 /***
39 * Create an instance of this object with the specified message id
40 *
41 * @param id is an integer which is used to look up the appropriate
42 * text string for this message from a resource file. The id of a
43 * message should be unique.
44 *
45 * @param register determines whether the new Message object should be
46 * registered with the central MessageManager object. This is normally
47 * desirable, as this allows the unit tests associated with clirr to
48 * verify that message ids are unique and that translations exist for
49 * all registered messages. However false can be useful in some
50 * circumstances, eg when creating Message objects for the purposes
51 * of unit tests.
52 */
53 public Message(int id, boolean register)
54 {
55 this.id = id;
56 if (register)
57 {
58 MessageManager.getInstance().addMessage(this);
59 }
60 }
61
62 public int getId()
63 {
64 return id;
65 }
66
67 public String toString()
68 {
69 return "Message#" + id;
70 }
71 }