Package nz.org.riskscape.engine.i18n
Class DefaultMessages
java.lang.Object
nz.org.riskscape.engine.i18n.DefaultMessages
- All Implemented Interfaces:
nz.org.riskscape.engine.i18n.Messages
-
Field Summary
Modifier and TypeFieldDescriptionprotected final I18nClassLoader
protected final ResourceBundleControl
-
Constructor Summary
ConstructorDescriptionDefaultMessages
(I18nClassLoader classLoader, ResourceBundleControl control, RiskscapeMessageSource help, RiskscapeMessageSource labels, RiskscapeMessageSource problems, DefaultObjectRenderer objectRenderer, nz.org.riskscape.engine.plugin.ExtensionPoints extensionPoints) DefaultMessages
(nz.org.riskscape.engine.plugin.ExtensionPoints extensionPoints) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPluginResources
(nz.org.riskscape.engine.plugin.Plugin plugin) static String
Construct an i18n code for looking up messages belonging to an identified object based on its id.static String
Construct an i18n code for looking up messages belonging to an identified object based on its id.getDetailedMessage
(nz.org.riskscape.engine.i18n.MessageSource msgs, Locale locale, Object owner, String... parts) getHelp()
getKnownBundleNames
(nz.org.riskscape.engine.plugin.ExtensionPoints eps) getMessage
(nz.org.riskscape.engine.i18n.MessageSource msgs, Locale locale, @NonNull Object owner, String... parts) getResourceBundle
(String baseName, Locale locale) Shortcut fornewMessageSource(baseName).getBundle(locale)
static String
getShortCode
(nz.org.riskscape.engine.Identified object, String... parts) Same asgetCode(Identified, String...)
except it strips off the package-name and just uses the class's simple name.newMessageSource
(String baseName) renderObject
(Object object, Locale locale) nz.org.riskscape.engine.i18n.RenderedProblem
renderProblem
(nz.org.riskscape.problem.Problem problem, Locale locale) void
setDefaultLocale
(Locale defaultLocale) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface nz.org.riskscape.engine.i18n.Messages
getDetailedHelpMessage, getDetailedMessage, getHelpMessage, getMessage, renderProblem, renderProblem, renderProblem
-
Field Details
-
classLoader
-
control
-
-
Constructor Details
-
DefaultMessages
public DefaultMessages(nz.org.riskscape.engine.plugin.ExtensionPoints extensionPoints) -
DefaultMessages
public DefaultMessages(I18nClassLoader classLoader, ResourceBundleControl control, RiskscapeMessageSource help, RiskscapeMessageSource labels, RiskscapeMessageSource problems, DefaultObjectRenderer objectRenderer, nz.org.riskscape.engine.plugin.ExtensionPoints extensionPoints)
-
-
Method Details
-
getCode
Construct an i18n code for looking up messages belonging to an identified object based on its id.
-
getShortCode
Same as
getCode(Identified, String...)
except it strips off the package-name and just uses the class's simple name. As the Identified object should already have a unique ID, the package-name is a bit unnecessary. -
getCode
Construct an i18n code for looking up messages belonging to an identified object based on its id. Keys take the form
nz.org.riskscape.engine.${API_CLASS}.by-id.${ID}.${part¹}.${part²}...
. For a model, this might look likenz.org.riskscape.engine.model.Model.by-id.default.param.filter
. -
newMessageSource
- Specified by:
newMessageSource
in interfacenz.org.riskscape.engine.i18n.Messages
-
getResourceBundle
Shortcut for
newMessageSource(baseName).getBundle(locale)
-
getMessage
public Optional<String> getMessage(nz.org.riskscape.engine.i18n.MessageSource msgs, Locale locale, @NonNull @NonNull Object owner, String... parts) - Specified by:
getMessage
in interfacenz.org.riskscape.engine.i18n.Messages
-
getDetailedMessage
public List<String> getDetailedMessage(nz.org.riskscape.engine.i18n.MessageSource msgs, Locale locale, Object owner, String... parts) - Specified by:
getDetailedMessage
in interfacenz.org.riskscape.engine.i18n.Messages
-
getKnownBundleNames
- Returns:
- a set of resource bundle names that are either well known riskscape bundles (such as help) or ones that
have been registered via a plugin with the
HasMessages
feature interface.
-
renderObject
- Specified by:
renderObject
in interfacenz.org.riskscape.engine.i18n.Messages
-
renderProblem
public nz.org.riskscape.engine.i18n.RenderedProblem renderProblem(nz.org.riskscape.problem.Problem problem, Locale locale) - Specified by:
renderProblem
in interfacenz.org.riskscape.engine.i18n.Messages
-
addPluginResources
public void addPluginResources(nz.org.riskscape.engine.plugin.Plugin plugin) - Specified by:
addPluginResources
in interfacenz.org.riskscape.engine.i18n.Messages
-
getClassLoader
-
getControl
-
getHelp
- Specified by:
getHelp
in interfacenz.org.riskscape.engine.i18n.Messages
-
getLabels
- Specified by:
getLabels
in interfacenz.org.riskscape.engine.i18n.Messages
-
getProblems
- Specified by:
getProblems
in interfacenz.org.riskscape.engine.i18n.Messages
-
getDefaultLocale
- Specified by:
getDefaultLocale
in interfacenz.org.riskscape.engine.i18n.Messages
-
setDefaultLocale
-