import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class ConfKit{
private static final String BUNDLE_NAME = "config";//config.properties
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
private ConfKit() {}
public static String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
}catch (MissingResourceException e) {
return '!' + key + '!';
}
}
public static String getString(String key, String[] paras) {
try {
String message = RESOURCE_BUNDLE.getString(key);
return MessageFormat.format(message, paras);
}catch (MissingResourceException e) {
return '!' + key + '!';
}
}
}