public class ModuleMessageSource extends Object implements org.springframework.context.MessageSource, JahiaModuleAware
| Constructor and Description |
|---|
ModuleMessageSource() |
| Modifier and Type | Method and Description |
|---|---|
String |
getMessage(org.springframework.context.MessageSourceResolvable resolvable,
Locale locale) |
String |
getMessage(String code,
Object[] args,
Locale locale) |
String |
getMessage(String code,
Object[] args,
String defaultMessage,
Locale locale) |
void |
setJahiaModule(JahiaTemplatesPackage module) |
void |
setUseCodeAsDefaultMessage(boolean useCodeAsDefaultMessage)
Set whether to use the message code as default message instead of throwing a NoSuchMessageException.
|
public String getMessage(org.springframework.context.MessageSourceResolvable resolvable, Locale locale) throws org.springframework.context.NoSuchMessageException
getMessage in interface org.springframework.context.MessageSourceorg.springframework.context.NoSuchMessageExceptionpublic String getMessage(String code, Object[] args, Locale locale) throws org.springframework.context.NoSuchMessageException
getMessage in interface org.springframework.context.MessageSourceorg.springframework.context.NoSuchMessageExceptionpublic String getMessage(String code, Object[] args, String defaultMessage, Locale locale)
getMessage in interface org.springframework.context.MessageSourcepublic void setJahiaModule(JahiaTemplatesPackage module)
setJahiaModule in interface JahiaModuleAwarepublic void setUseCodeAsDefaultMessage(boolean useCodeAsDefaultMessage)
Note: In case of a MessageSourceResolvable with multiple codes (like a FieldError) and a MessageSource that has a parent MessageSource, do not activate "useCodeAsDefaultMessage" in the parent: Else, you'll get the first code returned as message by the parent, without attempts to check further codes.
To be able to work with "useCodeAsDefaultMessage" turned on in the parent, AbstractMessageSource and AbstractApplicationContext
contain special checks to delegate to the internal #getMessageInternal method if available. In general, it is recommended to
just use "useCodeAsDefaultMessage" during development and not rely on it in production in the first place, though.
Copyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.