Class DefaultLocalizedNamesBase

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String[] likelyRegionCodes  
      protected java.util.Map<java.lang.String,​java.lang.String> namesMap  
      protected java.lang.String[] sortedRegionCodes  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String[] getLikelyRegionCodes()  
      java.lang.String getRegionName​(java.lang.String regionCode)
      Get the localized name of a given region in this locale.
      protected java.lang.String getRegionNameImpl​(java.lang.String regionCode)  
      java.lang.String[] getSortedRegionCodes()  
      protected java.lang.String[] loadLikelyRegionCodes()
      Returns a possibly-empty array of country codes, ordered by the literate population speaking this language.
      protected void loadNameMap()
      Initializes {namesMap to a map of region code (including non-country codes) to localized names.
      protected abstract java.lang.String[] loadSortedRegionCodes()
      Returns an array of currently valid country codes ordered by the collating order of the locale.
      protected boolean needsNameMap()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • likelyRegionCodes

        protected java.lang.String[] likelyRegionCodes
      • sortedRegionCodes

        protected java.lang.String[] sortedRegionCodes
      • namesMap

        protected java.util.Map<java.lang.String,​java.lang.String> namesMap
    • Constructor Detail

      • DefaultLocalizedNamesBase

        public DefaultLocalizedNamesBase()
    • Method Detail

      • getLikelyRegionCodes

        public final java.lang.String[] getLikelyRegionCodes()
        Specified by:
        getLikelyRegionCodes in interface LocalizedNames
        Returns:
        a possibly empty array of region codes, ordered by the literate population speaking the language of this locale.
      • getRegionName

        public final java.lang.String getRegionName​(java.lang.String regionCode)
        Description copied from interface: LocalizedNames
        Get the localized name of a given region in this locale.
        Specified by:
        getRegionName in interface LocalizedNames
        Returns:
        localized name
      • getSortedRegionCodes

        public final java.lang.String[] getSortedRegionCodes()
        Specified by:
        getSortedRegionCodes in interface LocalizedNames
        Returns:
        an array of region codes of currently valid countries, ordered according to the collating order of this locale.
      • getRegionNameImpl

        protected java.lang.String getRegionNameImpl​(java.lang.String regionCode)
      • loadLikelyRegionCodes

        protected java.lang.String[] loadLikelyRegionCodes()
        Returns a possibly-empty array of country codes, ordered by the literate population speaking this language. The default implementation is an empty array.
        Returns:
        a possibly-empty array of likely country codes
      • loadNameMap

        protected void loadNameMap()
        Initializes {namesMap to a map of region code (including non-country codes) to localized names. Subclasses should generally call the parent implementation and then change specific entries, though if most entries are being changed they can just create their own map.
      • loadSortedRegionCodes

        protected abstract java.lang.String[] loadSortedRegionCodes()
        Returns an array of currently valid country codes ordered by the collating order of the locale.
        Returns:
        an array of ordered country codes
      • needsNameMap

        protected boolean needsNameMap()
        Returns:
        true if the name map needs to be loaded -- subclasses that provide alternate storage for the name map (such as in JSOs) should override this.