java.text.MessageFormat handling but not implementing concrete
methods defined in the org.springframework.context.MessageSource .
AbstractMessageSource derives from this class, providing concrete
getMessage implementations that delegate to a central template
method for message code resolution.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private static final MessageFormat | |
| protected final Log | logger
Logger available to subclasses. |
| private final Map | messageFormatsPerMessage
Cache to hold already generated MessageFormats per message. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected MessageFormat | Returns: theMessageFormat instancethe message to create a msg, Locale MessageFormat forthe Locale to create a locale)MessageFormat forCreate a |
| protected String | Returns: the formatted message (with resolved arguments)the message to format msg, Object[] array of arguments that will be filled in for params within
the message, or args, Locale null if nonethe Locale used for formatting locale)Format the given message String, using cached MessageFormats. |
| protected boolean | isAlwaysUseMessageFormat()
Return whether to always apply the |
| protected String | Returns: the rendered default message (with resolved arguments)the passed-in default message String defaultMessage, Object[] array of arguments that will be filled in for params within
the message, or args, Locale null if none.the Locale used for formatting locale)Render the given default message String. |
| protected Object[] | Returns: the resolved argument arraythe original argument array args, Locale the Locale to resolve against locale)Template method for resolving argument objects. |
| public void | setAlwaysUseMessageFormat(boolean alwaysUseMessageFormat)
Set whether to always apply the |
| alwaysUseMessageFormat | back to summary |
|---|---|
| private boolean alwaysUseMessageFormat | |
| INVALID_MESSAGE_FORMAT | back to summary |
|---|---|
| private static final MessageFormat INVALID_MESSAGE_FORMAT | |
| logger | back to summary |
|---|---|
| protected final Log logger Logger available to subclasses. | |
| messageFormatsPerMessage | back to summary |
|---|---|
| private final Map<String, Map<Locale, MessageFormat>> messageFormatsPerMessage Cache to hold already generated MessageFormats per message. Used for passed-in default messages. MessageFormats for resolved codes are cached on a specific basis in subclasses. | |
| MessageSourceSupport | back to summary |
|---|---|
| public MessageSourceSupport() | |
| createMessageFormat | back to summary |
|---|---|
| protected MessageFormat createMessageFormat(String msg, Locale locale) Create a
| |
| formatMessage | back to summary |
|---|---|
| protected String formatMessage(String msg, Object[] args, Locale locale) Format the given message String, using cached MessageFormats. By default invoked for passed-in default messages, to resolve any argument placeholders found in them. | |
| isAlwaysUseMessageFormat | back to summary |
|---|---|
| protected boolean isAlwaysUseMessageFormat() Return whether to always apply the | |
| renderDefaultMessage | back to summary |
|---|---|
| protected String renderDefaultMessage(String defaultMessage, Object[] args, Locale locale) Render the given default message String. The default message is passed in as specified by the caller and can be rendered into a fully formatted default message shown to the user. The default implementation passes the String to
| |
| resolveArguments | back to summary |
|---|---|
| protected Object[] resolveArguments(Object[] args, Locale locale) Template method for resolving argument objects. The default implementation simply returns the given argument array as-is. Can be overridden in subclasses in order to resolve special argument types. | |
| setAlwaysUseMessageFormat | back to summary |
|---|---|
| public void setAlwaysUseMessageFormat(boolean alwaysUseMessageFormat) Set whether to always apply the Default is For example,
| |