01: /**
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */package com.tc.util;
04:
05: import java.text.MessageFormat;
06: import java.util.ResourceBundle;
07:
08: public class ResourceBundleHelper {
09: private ResourceBundle bundle;
10:
11: public ResourceBundleHelper(Class clas) {
12: bundle = AbstractResourceBundleFactory.getBundle(clas);
13: }
14:
15: public Object getObject(final String key) {
16: Assert.assertNotNull(key);
17: return bundle.getObject(key);
18: }
19:
20: public String getString(final String key) {
21: Assert.assertNotNull(key);
22: return bundle.getString(key);
23: }
24:
25: public String format(final String key, Object[] args) {
26: Assert.assertNotNull(key);
27: String fmt = getString(key);
28: Assert.assertNotNull(fmt);
29: return MessageFormat.format(fmt, args);
30: }
31: }
|