org.springframework.context.support.ResourceBundleMessageSource.resolveCodeWithoutArguments()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(70)

本文整理了Java中org.springframework.context.support.ResourceBundleMessageSource.resolveCodeWithoutArguments方法的一些代码示例,展示了ResourceBundleMessageSource.resolveCodeWithoutArguments的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceBundleMessageSource.resolveCodeWithoutArguments方法的具体详情如下:
包路径:org.springframework.context.support.ResourceBundleMessageSource
类名称:ResourceBundleMessageSource
方法名:resolveCodeWithoutArguments

ResourceBundleMessageSource.resolveCodeWithoutArguments介绍

[英]Resolves the given message code as key in the registered resource bundles, returning the value found in the bundle as-is (without MessageFormat parsing).
[中]将给定的消息代码解析为已注册资源束中的密钥,按原样返回在束中找到的值(不进行MessageFormat解析)。

代码示例

代码示例来源:origin: molgenis/molgenis

@Override
 // Overridden to make the visibility public
 public String resolveCodeWithoutArguments(String code, Locale locale) {
  return super.resolveCodeWithoutArguments(code, locale);
 }
}

代码示例来源:origin: com.github.vindell/spring-biz

@Override
protected String resolveCodeWithoutArguments(String code, Locale locale) {
  String module = RequestContextUtils.getModule();
  Assert.hasText(module, " module is not specified!");
  if(logger.isDebugEnabled()){
    logger.debug("module:" + module);
  }
  String result = null;
  for (String basename : basenames) {
    if (StringUtils.endsWithIgnoreCase(basename, module)) {
      ResourceBundle bundle = getResourceBundle(basename, locale);
      if (bundle != null) {
        result = getStringOrNull(bundle, code);
        if (result != null) {
          return result;
        }
      }
    }
  }
  return super.resolveCodeWithoutArguments(code, locale);
}

相关文章

微信公众号

最新文章

更多