Package com.ibm.icu.impl
Class ICUService.Key
java.lang.Object
com.ibm.icu.impl.ICUService.Key
- Direct Known Subclasses:
ICULocaleService.LocaleKey
- Enclosing class:
- ICUService
Keys are used to communicate with factories to generate an
instance of the service. Keys define how ids are
canonicalized, provide both a current id and a current
descriptor to use in querying the cache and factories, and
determine the fallback strategy.
Keys provide both a currentDescriptor and a currentID. The descriptor contains an optional prefix, followed by '/' and the currentID. Factories that handle complex keys, for example number format factories that generate multiple kinds of formatters for the same locale, use the descriptor to provide a fully unique identifier for the service object, while using the currentID (in this case, the locale string), as the visible IDs that can be localized.
The default implementation of Key has no fallbacks and has no custom descriptors.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the canonical version of the original ID.Return the current descriptor.Return the (canonical) current ID.boolean
fallback()
If the key has a fallback, modify the key and return true, otherwise return false.final String
id()
Return the original ID used to construct this key.boolean
isFallbackOf
(String idToCheck) If a key created from id would eventually fallback to match the canonical ID of this key, return true.
-
Field Details
-
id
-
-
Constructor Details
-
Key
Construct a key from an id.
-
-
Method Details
-
id
Return the original ID used to construct this key. -
canonicalID
Return the canonical version of the original ID. This implementation returns the original ID unchanged. -
currentID
Return the (canonical) current ID. This implementation returns the canonical ID. -
currentDescriptor
Return the current descriptor. This implementation returns the current ID. The current descriptor is used to fully identify an instance of the service in the cache. A factory may handle all descriptors for an ID, or just a particular descriptor. The factory can either parse the descriptor or use custom API on the key in order to instantiate the service. -
fallback
public boolean fallback()If the key has a fallback, modify the key and return true, otherwise return false. The current ID will change if there is a fallback. No currentIDs should be repeated, and fallback must eventually return false. This implementation has no fallbacks and always returns false. -
isFallbackOf
If a key created from id would eventually fallback to match the canonical ID of this key, return true.
-