@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; } }
@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; } }
@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; } }