All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jadeutils.text.MessageMap Maven / Gradle / Ivy

The newest version!
package jadeutils.text;

/*
 * 
 */

import java.text.MessageFormat;
import java.util.ResourceBundle;

/*
 * @author morgan
 * 
 */
public class MessageMap {
	ResourceBundle resourceBundle = null;

	public MessageMap(String fileName) {
		this.resourceBundle = ResourceBundle.getBundle(fileName);
	}

	/*
	 * 

* load from prop file *

* * @param msgKey * @return */ public String getMessage(String msgKey) { String strErrorMsg = "Err load msg properties"; try { strErrorMsg = this.resourceBundle.getString(msgKey); } catch (Exception e) { // do nothing } return strErrorMsg; } /* *

* load form prop *

* * @param msgKey * @param params * @return */ public String getMessage(String msgKey, String[] params) { Object obj[] = params; String strErrorMsg = this.getMessage(msgKey); try { strErrorMsg = MessageFormat.format(strErrorMsg, obj); } catch (Exception e) { // do nothing } return strErrorMsg; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy