Package ca.uhn.fhir.i18n
Class HapiLocalizer
- java.lang.Object
-
- ca.uhn.fhir.i18n.HapiLocalizer
-
public class HapiLocalizer extends Object
This feature is not yet in its final state and should be considered an internal part of HAPI for now - use with caution
-
-
Field Summary
Fields Modifier and Type Field Description static StringUNKNOWN_I18N_KEY_MESSAGE
-
Constructor Summary
Constructors Constructor Description HapiLocalizer()HapiLocalizer(String... theBundleNames)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddMessage(String theKey, String theMessage)Subclasses may use this to add hardcoded messagesSet<String>getAllKeys()StringgetFormatString(String theQualifiedKey)StringgetMessage(Class<?> theType, String theKey, Object... theParameters)StringgetMessage(String theQualifiedKey, Object... theParameters)StringgetMessageSanitized(Class<?> theType, String theKey, Object... theParameters)Create the message and sanitize parameters usingprotected voidinit()static voidsetOurFailOnMissingMessage(boolean ourFailOnMissingMessage)This global setting causes the localizer to fail if any attempts are made to retrieve a key that does not exist.static StringtoKey(Class<?> theType, String theKey)
-
-
-
Field Detail
-
UNKNOWN_I18N_KEY_MESSAGE
public static final String UNKNOWN_I18N_KEY_MESSAGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HapiLocalizer
public HapiLocalizer()
-
HapiLocalizer
public HapiLocalizer(String... theBundleNames)
-
-
Method Detail
-
addMessage
protected void addMessage(String theKey, String theMessage)
Subclasses may use this to add hardcoded messages
-
getAllKeys
public Set<String> getAllKeys()
-
getFormatString
public String getFormatString(String theQualifiedKey)
- Returns:
- Returns the raw message format string for the given key, or returns
UNKNOWN_I18N_KEY_MESSAGEif not found
-
getMessage
public String getMessage(Class<?> theType, String theKey, Object... theParameters)
-
getMessageSanitized
public String getMessageSanitized(Class<?> theType, String theKey, Object... theParameters)
Create the message and sanitize parameters using
-
getMessage
public String getMessage(String theQualifiedKey, Object... theParameters)
-
init
protected void init()
-
setOurFailOnMissingMessage
public static void setOurFailOnMissingMessage(boolean ourFailOnMissingMessage)
This global setting causes the localizer to fail if any attempts are made to retrieve a key that does not exist. This method is primarily for unit tests.
-
-