added a getMessage(final Locale locale) to class MathIllegalArgumentException

similar to the ones from MathException and MathRuntimeException

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@981247 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2010-08-01 15:35:33 +00:00
parent 972ab8b3b2
commit 59a4edb84d
1 changed files with 22 additions and 19 deletions

View File

@ -71,32 +71,35 @@ public class MathIllegalArgumentException extends IllegalArgumentException {
this(null, general, args);
}
/** {@inheritDoc} */
/** Gets the message in a specified locale.
*
* @param locale Locale in which the message should be translated
*
* @return localized message
* @since 2.2
*/
public String getMessage(final Locale locale) {
final StringBuilder sb = new StringBuilder();
if (specific != null) {
sb.append(MessageFactory.buildMessage(locale, specific, arguments));
sb.append(": ");
}
sb.append(MessageFactory.buildMessage(locale, general, arguments));
return sb.toString();
}
/** {@inheritDoc} */
@Override
public String getMessage() {
final StringBuilder sb = new StringBuilder();
if (specific != null) {
sb.append(MessageFactory.buildMessage(Locale.US, specific, arguments));
sb.append(": ");
}
sb.append(MessageFactory.buildMessage(Locale.US, general, arguments));
return sb.toString();
return getMessage(Locale.US);
}
/** {@inheritDoc} */
@Override
public String getLocalizedMessage() {
final StringBuilder sb = new StringBuilder();
if (specific != null) {
sb.append(MessageFactory.buildMessage(Locale.getDefault(), specific, arguments));
sb.append(": ");
}
sb.append(MessageFactory.buildMessage(Locale.getDefault(), general, arguments));
return sb.toString();
return getMessage(Locale.getDefault());
}
/**