Java Resource Message getMessage(String key)

Here you can find the source of getMessage(String key)

Description

get Message

License

Open Source License

Declaration

public static String getMessage(String key) 

Method Source Code

//package com.java2s;
/**/*  w  w w . j av  a  2 s  . c  om*/
 * Created www.19drops.com
 * User: 19drops
 * Date: 13-sep-2009
 * Time: 16:23:26
 * <p/>
 * This material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 * <p/>
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 * <p/>
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, write to:
 * Free Software Foundation, Inc.
 * 51 Franklin Street, Fifth Floor
 * Boston, MA 02110-1301 USA
 */

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

public class Main {
    public static String getMessage(String key) {
        return getBundle().getString(key);
    }

    public static String getMessage(String key, String... parm) {
        String keyValue = getBundle().getString(key);
        return MessageFormat.format(keyValue, parm);
    }

    private static ResourceBundle getBundle() {
        return ResourceBundle.getBundle("TRACdropsMessage");
    }
}

Related

  1. getMessage(ResourceBundle bundle, String key, Object... params)
  2. getMessage(ResourceBundle bundle, String key, Object... params)
  3. getMessage(ResourceBundle messages, String messageKey)
  4. getMessage(ResourceBundle messages, String msgKey, Object[] arguments)
  5. getMessage(String bundleName, Locale locale, String key, String defaultMsg)
  6. getMessage(String key)
  7. getMessage(String key)
  8. getMessage(String key, Object... contents)
  9. getMessage(String key, Object... values)