Java Message Format formatMessage(String message, Object param1)

Here you can find the source of formatMessage(String message, Object param1)

Description

format Message

License

Open Source License

Declaration

public static String formatMessage(String message, Object param1) 

Method Source Code


//package com.java2s;
import java.text.MessageFormat;

public class Main {

    public static String formatMessage(String message, Object[] params) {
        if ((message == null) || (params == null) || (params.length == 0)) {
            return message;
        }/*from  w ww.j a v a 2 s  . c  om*/

        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 });
    }
}

Related

  1. formatCause(final String message, final Throwable cause, final Object... args)
  2. formatDuring(long mss, String pattern)
  3. formatError(Map.Entry entry, String errorPlural, String errorSingular)
  4. formatMessage(final String pattern, final Object... params)
  5. formatMessage(final String pattern, final String param1)
  6. formatMessage(String message, Object... args)
  7. formatResource(Object[] info, String require)
  8. formats(String pattern, Object... args)
  9. formatString(ResourceBundle resourceBundle, String key, Object data)