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