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

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

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

ReloadableResourceBundleMessageSource.createMessageFormat介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Nullable
  public MessageFormat getMessageFormat(String code, Locale locale) {
    if (this.properties == null) {
      return null;
    }
    Map<Locale, MessageFormat> localeMap = this.cachedMessageFormats.get(code);
    if (localeMap != null) {
      MessageFormat result = localeMap.get(locale);
      if (result != null) {
        return result;
      }
    }
    String msg = this.properties.getProperty(code);
    if (msg != null) {
      if (localeMap == null) {
        localeMap = new ConcurrentHashMap<>();
        Map<Locale, MessageFormat> existing = this.cachedMessageFormats.putIfAbsent(code, localeMap);
        if (existing != null) {
          localeMap = existing;
        }
      }
      MessageFormat result = createMessageFormat(msg, locale);
      localeMap.put(locale, result);
      return result;
    }
    return null;
  }
}

代码示例来源:origin: org.springframework/spring-context

@Nullable
  public MessageFormat getMessageFormat(String code, Locale locale) {
    if (this.properties == null) {
      return null;
    }
    Map<Locale, MessageFormat> localeMap = this.cachedMessageFormats.get(code);
    if (localeMap != null) {
      MessageFormat result = localeMap.get(locale);
      if (result != null) {
        return result;
      }
    }
    String msg = this.properties.getProperty(code);
    if (msg != null) {
      if (localeMap == null) {
        localeMap = new ConcurrentHashMap<>();
        Map<Locale, MessageFormat> existing = this.cachedMessageFormats.putIfAbsent(code, localeMap);
        if (existing != null) {
          localeMap = existing;
        }
      }
      MessageFormat result = createMessageFormat(msg, locale);
      localeMap.put(locale, result);
      return result;
    }
    return null;
  }
}

代码示例来源:origin: apache/servicemix-bundles

@Nullable
  public MessageFormat getMessageFormat(String code, Locale locale) {
    if (this.properties == null) {
      return null;
    }
    Map<Locale, MessageFormat> localeMap = this.cachedMessageFormats.get(code);
    if (localeMap != null) {
      MessageFormat result = localeMap.get(locale);
      if (result != null) {
        return result;
      }
    }
    String msg = this.properties.getProperty(code);
    if (msg != null) {
      if (localeMap == null) {
        localeMap = new ConcurrentHashMap<>();
        Map<Locale, MessageFormat> existing = this.cachedMessageFormats.putIfAbsent(code, localeMap);
        if (existing != null) {
          localeMap = existing;
        }
      }
      MessageFormat result = createMessageFormat(msg, locale);
      localeMap.put(locale, result);
      return result;
    }
    return null;
  }
}

相关文章

微信公众号

最新文章

更多

ReloadableResourceBundleMessageSource类方法