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
-
Constructor Summary
ConstructorDescriptionRiskscapeMessageSource
(String baseName, ClassLoader classLoader) RiskscapeMessageSource
(Function<Locale, ResourceBundle> resourceBundleFunction) -
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceBundle
getBundle
(String baseName, Locale locale, ClassLoader classLoader) Gets a resource bundle using riskscape's customizedResourceBundle.Control
rules.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 withProblem
s which is aMessageKey
but default messages for problems may contain { or }. This handling should be removed.Pattern
used to detect if a message contains andMessageFormat
format 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.Control
rules.- See Also:
-
getMessage
- Specified by:
getMessage
in interfacenz.org.riskscape.engine.i18n.MessageSource
-
getMessage
- Specified by:
getMessage
in interfacenz.org.riskscape.engine.i18n.MessageSource
-
getMessage
- Specified by:
getMessage
in interfacenz.org.riskscape.engine.i18n.MessageSource
-
getMessage
- Specified by:
getMessage
in interfacenz.org.riskscape.engine.i18n.MessageSource
-
getMessage
- Specified by:
getMessage
in 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:
getMessageFactory
in interfacenz.org.riskscape.engine.i18n.MessageSource
-
Problem
s which is aMessageKey
but default messages for problems may contain { or }.