Java Utililty Methods Message Format

List of utility methods to do Message Format

Description

The list of methods to do Message Format are organized into topic(s).

Method

Stringformat(final String message, final Object... args)
format
if (args == null || args.length == 0) {
    return message;
} else {
    return MessageFormat.format(message, args);
Stringformat(final String template, final Object... arguments)
format
return MessageFormat.format(template, arguments);
Stringformat(ResourceBundle bundle, String key, Object... args)
format
try {
    String message = bundle.getString(key);
    return MessageFormat.format(message, args);
} catch (MissingResourceException e) {
    return '!' + key + '!';
Stringformat(String activity, Object item, Long count, Long total)
format
String msg;
if (count != null) {
    if (total != null) {
        msg = MessageFormat.format("{0} {1} ({2} of {3})", activity, item, count, total);
    } else {
        msg = MessageFormat.format("{0} {1} ({2})", activity, item, count);
} else {
...
Stringformat(String key, Object... values)
format
return MessageFormat.format(key, values);
Stringformat(String message, Object argument)
Formats the given string with the given argument.
return MessageFormat.format(message, new Object[] { argument });
Stringformat(String message, Object object)
format
return MessageFormat.format(message, new Object[] { object });
Stringformat(String message, Object parameter)
format
return format(message, new Object[] { parameter });
Stringformat(String message, Object... params)
Formats the message with the given arguments.
if (params != null && params.length > 0)
    return MessageFormat.format(message, params);
else
    return message;
Stringformat(String pattern, Map params)
format
return format(pattern, params, "{", "}");