Class ICUBundleMessageSource

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.context.HierarchicalMessageSource, org.springframework.context.MessageSource, org.springframework.context.ResourceLoaderAware

    public class ICUBundleMessageSource
    extends org.springframework.context.support.ReloadableResourceBundleMessageSource
    ICU4j Overrides, Lots of copy/paste horseplay as so much in ReloadableResourceBundleMessageSource is private and final. Also instead of supporting XML like it does, we support YAMl instead. The core issue here is that we need to return com.ibm.icu.text.MessageFormat and not java.text.MessageFormat. TODO: Need to confirm what wins if defined in both places.
    • Field Summary

      • Fields inherited from class org.springframework.context.support.MessageSourceSupport

        logger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.List<java.lang.String> calculateAllFilenames​(java.lang.String basename, java.util.Locale locale)  
      void clearCache()  
      protected java.text.MessageFormat createMessageFormat​(java.lang.String msg, java.util.Locale locale)  
      protected com.ibm.icu.text.MessageFormat createMessageFormatICU​(java.lang.String msg, java.util.Locale locale)  
      protected ICUBundleMessageSource.PropertiesHolder getMergedProperties​(java.util.Locale locale)  
      protected ICUBundleMessageSource.PropertiesHolder getProperties​(java.lang.String filename)  
      protected java.util.Properties loadProperties​(org.springframework.core.io.Resource resource, java.lang.String filename)  
      protected long mergeExternalProperties​(java.util.Locale locale, java.util.Properties mergedProps)  
      protected void mergePluginProperties​(java.util.Locale locale, java.util.Properties mergedProps)  
      ICUBundleMessageSource.PropertiesHolder refreshPropertiesICU​(java.lang.String filename, ICUBundleMessageSource.PropertiesHolder propHolder)  
      protected java.text.MessageFormat resolveCode​(java.lang.String code, java.util.Locale locale)  
      protected com.ibm.icu.text.MessageFormat resolveCodeICU​(java.lang.String code, java.util.Locale locale)
      Resolves the given message code as key in the retrieved bundle files, using a cached MessageFormat instance per message code.
      • Methods inherited from class org.springframework.context.support.ReloadableResourceBundleMessageSource

        calculateFilenamesForLocale, clearCacheIncludingAncestors, newProperties, refreshProperties, resolveCodeWithoutArguments, setConcurrentRefresh, setFileEncodings, setPropertiesPersister, setResourceLoader, toString
      • Methods inherited from class org.springframework.context.support.AbstractResourceBasedMessageSource

        addBasenames, getBasenameSet, getCacheMillis, getDefaultEncoding, getDefaultLocale, isFallbackToSystemLocale, setBasename, setBasenames, setCacheMillis, setCacheSeconds, setDefaultEncoding, setDefaultLocale, setFallbackToSystemLocale
      • Methods inherited from class org.springframework.context.support.AbstractMessageSource

        getCommonMessages, getDefaultMessage, getDefaultMessage, getMessage, getMessage, getMessage, getMessageFromParent, getMessageInternal, getParentMessageSource, isUseCodeAsDefaultMessage, resolveArguments, setCommonMessages, setParentMessageSource, setUseCodeAsDefaultMessage
      • Methods inherited from class org.springframework.context.support.MessageSourceSupport

        formatMessage, isAlwaysUseMessageFormat, renderDefaultMessage, setAlwaysUseMessageFormat
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ICUBundleMessageSource

        public ICUBundleMessageSource()
    • Method Detail

      • resolveCode

        @Nullable
        protected java.text.MessageFormat resolveCode​(java.lang.String code,
                                                      java.util.Locale locale)
        Overrides:
        resolveCode in class org.springframework.context.support.ReloadableResourceBundleMessageSource
      • resolveCodeICU

        @Nullable
        protected com.ibm.icu.text.MessageFormat resolveCodeICU​(java.lang.String code,
                                                                java.util.Locale locale)
        Resolves the given message code as key in the retrieved bundle files, using a cached MessageFormat instance per message code.
      • mergePluginProperties

        protected void mergePluginProperties​(java.util.Locale locale,
                                             java.util.Properties mergedProps)
      • mergeExternalProperties

        protected long mergeExternalProperties​(java.util.Locale locale,
                                               java.util.Properties mergedProps)
      • calculateAllFilenames

        protected java.util.List<java.lang.String> calculateAllFilenames​(java.lang.String basename,
                                                                         java.util.Locale locale)
        Overrides:
        calculateAllFilenames in class org.springframework.context.support.ReloadableResourceBundleMessageSource
      • getMergedProperties

        protected ICUBundleMessageSource.PropertiesHolder getMergedProperties​(java.util.Locale locale)
        Overrides:
        getMergedProperties in class org.springframework.context.support.ReloadableResourceBundleMessageSource
      • getProperties

        protected ICUBundleMessageSource.PropertiesHolder getProperties​(java.lang.String filename)
        Overrides:
        getProperties in class org.springframework.context.support.ReloadableResourceBundleMessageSource
      • loadProperties

        protected java.util.Properties loadProperties​(org.springframework.core.io.Resource resource,
                                                      java.lang.String filename)
                                               throws java.io.IOException
        Overrides:
        loadProperties in class org.springframework.context.support.ReloadableResourceBundleMessageSource
        Throws:
        java.io.IOException
      • clearCache

        public void clearCache()
        Overrides:
        clearCache in class org.springframework.context.support.ReloadableResourceBundleMessageSource
      • createMessageFormatICU

        protected com.ibm.icu.text.MessageFormat createMessageFormatICU​(java.lang.String msg,
                                                                        java.util.Locale locale)
      • createMessageFormat

        protected java.text.MessageFormat createMessageFormat​(java.lang.String msg,
                                                              java.util.Locale locale)
        Overrides:
        createMessageFormat in class org.springframework.context.support.MessageSourceSupport