code: public static String format(final Locale locale, final Object message) {
  		if (message instanceof Message) {
  			String text = ((Message) message).getMessage();
  			Serializable[] args = ((Message) message).getArgs();
  
  			if (text == null) {
  				return null;
  			}
  
  			return format(locale, text, (Object[]) args);
  		} else if (message != null) {
  			return format(locale, message.toString(), (Object[]) null);
  		}
  
  		return null;
  	}
docs: <p>
  Attempts to format the given message for the given locale.</p>
  
  <p>
  If a locale is provided, this method will attempt to load the text from a resource bundle. If
  <code>message</code> is a {@link Message} and has format arguments, then {@link MessageFormat} will be used to
  format the final message.</p>
  
  @param locale the locale to use, or null to use the current UIContext's Locale.
  @param message the message object to format.
  @return the formatted message.