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
public static class ICUService.Key extends java.lang.Object
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 Modifier and Type Field Description private java.lang.String
id
-
Constructor Summary
Constructors Constructor Description Key(java.lang.String id)
Construct a key from an id.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
canonicalID()
Return the canonical version of the original ID.java.lang.String
currentDescriptor()
Return the current descriptor.java.lang.String
currentID()
Return the (canonical) current ID.boolean
fallback()
If the key has a fallback, modify the key and return true, otherwise return false.java.lang.String
id()
Return the original ID used to construct this key.boolean
isFallbackOf(java.lang.String idToCheck)
If a key created from id would eventually fallback to match the canonical ID of this key, return true.
-
-
-
Method Detail
-
id
public final java.lang.String id()
Return the original ID used to construct this key.
-
canonicalID
public java.lang.String canonicalID()
Return the canonical version of the original ID. This implementation returns the original ID unchanged.
-
currentID
public java.lang.String currentID()
Return the (canonical) current ID. This implementation returns the canonical ID.
-
currentDescriptor
public java.lang.String 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
public boolean isFallbackOf(java.lang.String idToCheck)
If a key created from id would eventually fallback to match the canonical ID of this key, return true.
-
-