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
FieldsModifier and TypeFieldDescriptionprotected final I18nClassLoaderprotected final ResourceBundleControl -
Constructor Summary
ConstructorsConstructorDescriptionDefaultMessages(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 TypeMethodDescriptionvoidaddPluginResources(nz.org.riskscape.engine.plugin.Plugin plugin) static StringConstruct an i18n code for looking up messages belonging to an identified object based on its id.static StringConstruct 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 StringgetShortCode(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.RenderedProblemrenderProblem(nz.org.riskscape.problem.Problem problem, Locale locale) voidsetDefaultLocale(Locale defaultLocale) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
newMessageSourcein 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:
getMessagein 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:
getDetailedMessagein 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
HasMessagesfeature interface.
-
renderObject
- Specified by:
renderObjectin 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:
renderProblemin interfacenz.org.riskscape.engine.i18n.Messages
-
addPluginResources
public void addPluginResources(nz.org.riskscape.engine.plugin.Plugin plugin) - Specified by:
addPluginResourcesin interfacenz.org.riskscape.engine.i18n.Messages
-
getClassLoader
-
getControl
-
getHelp
- Specified by:
getHelpin interfacenz.org.riskscape.engine.i18n.Messages
-
getLabels
- Specified by:
getLabelsin interfacenz.org.riskscape.engine.i18n.Messages
-
getProblems
- Specified by:
getProblemsin interfacenz.org.riskscape.engine.i18n.Messages
-
getDefaultLocale
- Specified by:
getDefaultLocalein interfacenz.org.riskscape.engine.i18n.Messages
-
setDefaultLocale
-