Here you can find the source of getMessage(Properties props, String key, Object param)
public static String getMessage(Properties props, String key, Object param)
//package com.java2s; //License from project: Apache License import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.Properties; import java.util.ResourceBundle; public class Main { public static String getMessage(ResourceBundle bundle, String key, Object[] params) { if ((bundle == null) || (key == null)) { return key; }/*from w w w. ja v a 2s.c o m*/ try { String message = bundle.getString(key); return formatMessage(message, params); } catch (MissingResourceException e) { return key; } } public static String getMessage(ResourceBundle bundle, String key, Object param1) { return getMessage(bundle, key, new Object[] { param1 }); } public static String getMessage(ResourceBundle bundle, String key, Object param1, Object param2) { return getMessage(bundle, key, new Object[] { param1, param2 }); } public static String getMessage(ResourceBundle bundle, String key, Object param1, Object param2, Object param3) { return getMessage(bundle, key, new Object[] { param1, param2, param3 }); } public static String getMessage(ResourceBundle bundle, String key, Object param1, Object param2, Object param3, Object param4) { return getMessage(bundle, key, new Object[] { param1, param2, param3, param4 }); } public static String getMessage(ResourceBundle bundle, String key, Object param1, Object param2, Object param3, Object param4, Object param5) { return getMessage(bundle, key, new Object[] { param1, param2, param3, param4, param5 }); } public static String getMessage(Properties props, String key, Object param) { return getMessage(props, key, new Object[] { param }); } public static String getMessage(Properties props, String key, Object[] params) { if ((props == null) || (key == null)) { return key; } try { String message = props.getProperty(key); return formatMessage(message, params); } catch (MissingResourceException e) { return key; } } public static String formatMessage(String message, Object[] params) { if ((message == null) || (params == null) || (params.length == 0)) { return message; } return MessageFormat.format(message, params); } public static String formatMessage(String message, Object param1) { return formatMessage(message, new Object[] { param1 }); } public static String formatMessage(String message, Object param1, Object param2) { return formatMessage(message, new Object[] { param1, param2 }); } public static String formatMessage(String message, Object param1, Object param2, Object param3) { return formatMessage(message, new Object[] { param1, param2, param3 }); } public static String formatMessage(String message, Object param1, Object param2, Object param3, Object param4) { return formatMessage(message, new Object[] { param1, param2, param3, param4 }); } public static String formatMessage(String message, Object param1, Object param2, Object param3, Object param4, Object param5) { return formatMessage(message, new Object[] { param1, param2, param3, param4, param5 }); } }