Class RiskscapeMessageSource
- All Implemented Interfaces:
nz.org.riskscape.engine.i18n.MessageSource
MessageSource implementation that will resolve messages:
- from many ResourceBundle baseNames
- will merge property files with the same base name across a classpath using MergedPropertiesResourceBundle
- will fallback through locales for values using built-in ResourceBundle parenting logic
For a given message key bundle base names are searched in reverse. E.g the last base name added is searched first.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRiskscapeMessageSource(String baseName, ClassLoader classLoader) RiskscapeMessageSource(Function<Locale, ResourceBundle> resourceBundleFunction) -
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceBundlegetBundle(String baseName, Locale locale, ClassLoader classLoader) Gets a resource bundle using riskscape's customizedResourceBundle.Controlrules.getMessage(String code, Object... args) getMessage(String code, Object[] args, String defaultMessage, Locale locale) getMessage(String code, Object[] args, Locale locale) getMessage(nz.org.riskscape.engine.i18n.MessageKey resolvable) getMessage(nz.org.riskscape.engine.i18n.MessageKey resolvable, Locale locale) <T extends nz.org.riskscape.engine.i18n.MessageFactory>
TgetMessageFactory(Class<T> factory, Locale locale) Returns an implementation of the given factory class that resolves messages against the given locale and message source.
-
Field Details
-
MESSAGE_FORMAT_DETECTOR
Deprecated.detecting if the message is a format is only necessary for backwards compatibility withProblems which is aMessageKeybut default messages for problems may contain { or }. This handling should be removed.Patternused to detect if a message contains andMessageFormatformat specifiers.If no format specifiers are found then the message can be returned without performing any unnecessary formatting.
-
-
Constructor Details
-
RiskscapeMessageSource
-
RiskscapeMessageSource
-
-
Method Details
-
getBundle
Gets a resource bundle using riskscape's customized
ResourceBundle.Controlrules.- See Also:
-
getMessage
- Specified by:
getMessagein interfacenz.org.riskscape.engine.i18n.MessageSource
-
getMessage
- Specified by:
getMessagein interfacenz.org.riskscape.engine.i18n.MessageSource
-
getMessage
- Specified by:
getMessagein interfacenz.org.riskscape.engine.i18n.MessageSource
-
getMessage
- Specified by:
getMessagein interfacenz.org.riskscape.engine.i18n.MessageSource
-
getMessage
- Specified by:
getMessagein interfacenz.org.riskscape.engine.i18n.MessageSource
-
getBundle
-
getMessageFactory
public <T extends nz.org.riskscape.engine.i18n.MessageFactory> T getMessageFactory(Class<T> factory, Locale locale) Returns an implementation of the given factory class that resolves messages against the given locale and message source. Defers to
MessageFactoryProxy.- Specified by:
getMessageFactoryin interfacenz.org.riskscape.engine.i18n.MessageSource
-
Problems which is aMessageKeybut default messages for problems may contain { or }.