Resourece bundle,getting the values from message.properties file

import java.util.MissingResourceException;
import java.util.ResourceBundle;

/**
* This is a utility class designed to deal directly with the com/sportsbetting/affiliate/web/messages/messages.properties resource bundle.
* More work is expected to introduce internationalization handling.
* @author Affiliates
*
*/
public abstract class Messages {
public static final String BUNDLE_NAME = “com.sportsbetting.affiliateadmin.web.messages.messages”; //$NON-NLS-1$

private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);

/**
* @param key
* @return key-value
*/
public static String getString(String key) {
// TODO Auto-generated method stub
try {
return RESOURCE_BUNDLE.getString(key);
} catch (MissingResourceException e) {
return ‘!’ + key + ‘!’;
}
}

———-
//using this get the value from messages.properties file
Messages.getString(MSGK_SUCC_FEED_UPDATED)

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.