1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.whatsnew.lang;
17
18 import java.util.MissingResourceException;
19 import java.util.ResourceBundle;
20
21
22 /***
23 * <p>
24 * Utility class for Application messages grab
25 * </p>
26 *
27 * @author <a href="mailto:dquintela@users.sourceforge.net">Diogo Quintela</a>
28 * @version $Id: Messages.java,v 1.1 2004/05/13 01:22:33 dquintela Exp $
29 */
30 public class Messages {
31 /*** Bundle name/location */
32 private static final String MESSAGES_NAME = "net.sf.whatsnew.lang.messages";
33
34 /*** Resource bundle for messages */
35 private static final ResourceBundle MESSAGES_BUNDLE = ResourceBundle
36 .getBundle(MESSAGES_NAME);
37
38 /***
39 * Creates a new Messages object.<br>
40 * Disable instantiation
41 */
42 private Messages() {
43
44 }
45
46 /***
47 * Obtain message based on key value
48 *
49 * @param key The key to lookup for
50 *
51 * @return The message
52 */
53 public static String getString(String key) {
54 try {
55 return MESSAGES_BUNDLE.getString(key);
56 } catch (MissingResourceException e) {
57 return '!' + key + '!';
58 }
59 }
60 }
61