/**
* 查找错误消息
*
* @param source
* @param code
* @param params
* @param defaultMsg
* @return
*/
public static int getIntMessage(MessageSource source, String code, Object[] params, String defaultMsg) {
if (Check.NuNObj(source)) {
throw new IllegalArgumentException("message source is null");
}
if (Check.NuNStrStrict(code)) {
throw new IllegalArgumentException("code is empty");
}
//如果没有object 默认设置为空数组
if (Check.NuNObj(params)) {
params = new Object[]{};
}
String message = null;
if (Check.NuNStrStrict(defaultMsg)) {
message = source.getMessage(code, params, Locale.SIMPLIFIED_CHINESE);
} else {
message = source.getMessage(code, params, defaultMsg, Locale.SIMPLIFIED_CHINESE);
}
if (Check.NuNStrStrict(message)) {
throw new NumberFormatException("message is empty");
} else {
return Integer.valueOf(message);
}
}
MessageSourceUtil.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:asura
作者:
评论列表
文章目录