3 import java.text.MessageFormat;
4 import java.util.MissingResourceException;
5 import java.util.ResourceBundle;
7 public class Messages {
9 private static final String BUNDLE_NAME = "com.quantum.QuantumResources"; //$NON-NLS-1$
11 private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
16 public static String getString(Class resourceClass, String key) {
18 createKey(resourceClass, key));
21 private static String createKey(Class resourceClass, String key) {
22 return resourceClass.getName() + (key.startsWith(".") ? key : "." + key);
25 public static String getString(String key) {
27 return RESOURCE_BUNDLE.getString(key);
28 } catch (MissingResourceException e) {
29 return '!' + key + '!';
33 public static String getString(Class resourceClass, String key, Object[] arguments) {
34 return getString(createKey(resourceClass, key), arguments);
37 public static String getString(String key, Object[] arguments) {
38 String string = getString(key);
39 return MessageFormat.format(string, arguments);