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

net.jangaroo.jooc.util.MessageFormat Maven / Gradle / Ivy

There is a newer version: 4.1.17
Show newest version
package net.jangaroo.jooc.util;

/**
 * A better {@link java.text.MessageFormat} that takes an arbitrary number of parameters.
 * This is to avoid a pitfall in the original MessageFormat: if you call {@link java.text.MessageFormat#format(Object)}
 * you'd assume that the parameter is a single argument. Instead, it has to be an Object[] like
 * in the old times. This is unintuitive, as {@link java.text.MessageFormat#format(String, Object...)}
 * works in the modern way.
 *
 * @see java.text.MessageFormat
 */
public class MessageFormat {

  private java.text.MessageFormat messageFormat;

  public MessageFormat(String pattern) {
    messageFormat = new java.text.MessageFormat(pattern);
  }

  public String format(Object ...arguments) {
    return messageFormat.format(arguments);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy