Package com.google.gwt.i18n.client
Class DefaultLocalizedNamesBase
- java.lang.Object
-
- com.google.gwt.i18n.client.DefaultLocalizedNamesBase
-
- All Implemented Interfaces:
LocalizedNames
- Direct Known Subclasses:
DefaultLocalizedNames
public abstract class DefaultLocalizedNamesBase extends java.lang.Object implements LocalizedNames
Base class ofDefaultLocalizedNames
, used just to isolate all hand-written code here from all generated code.
-
-
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
-
Constructor Summary
Constructors Constructor Description DefaultLocalizedNamesBase()
-
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()
-
-
-
Method Detail
-
getLikelyRegionCodes
public final java.lang.String[] getLikelyRegionCodes()
- Specified by:
getLikelyRegionCodes
in interfaceLocalizedNames
- 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 interfaceLocalizedNames
- Returns:
- localized name
-
getSortedRegionCodes
public final java.lang.String[] getSortedRegionCodes()
- Specified by:
getSortedRegionCodes
in interfaceLocalizedNames
- 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.
-
-