MessageSource implementations based on
resource bundle conventions, such as ResourceBundleMessageSource
and ReloadableResourceBundleMessageSource. Provides common
configuration methods and corresponding semantic definitions.
ResourceBundleMessageSource, ReloadableResourceBundleMessageSource
| Modifier and Type | Field and Description |
|---|---|
| private final Set | |
| private long | |
| private String | |
| private Locale | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addBasenames(String... basenames)
Add the specified basenames to the existing basename configuration. |
| public Set | getBasenameSet()
Return this |
| protected long | |
| protected String | |
| protected Locale | getDefaultLocale()
Determine a default Locale to fall back to: either a locally specified default
Locale or the system Locale, or |
| protected boolean | isFallbackToSystemLocale()
Deprecated
as of 5.2.2, in favor of
Return whether to fall back to the system Locale if no files for a specific
Locale have been found.
getDefaultLocale()
|
| public void | setBasename(String
the single basename basename)Set a single basename, following the basic ResourceBundle convention of not specifying file extension or language codes. |
| public void | setBasenames(String...
an array of basenames basenames)Set an array of basenames, each following the basic ResourceBundle convention of not specifying file extension or language codes. |
| public void | |
| public void | |
| public void | setDefaultEncoding(String
the default charset defaultEncoding)Set the default charset to use for parsing properties files. |
| public void | setDefaultLocale(Locale defaultLocale)
Specify a default Locale to fall back to, as an alternative to falling back to the system Locale. |
| public void | setFallbackToSystemLocale(boolean fallbackToSystemLocale)
Set whether to fall back to the system Locale if no files for a specific Locale have been found. |
| basenameSet | back to summary |
|---|---|
| private final Set<String> basenameSet | |
| cacheMillis | back to summary |
|---|---|
| private long cacheMillis | |
| defaultEncoding | back to summary |
|---|---|
| private String defaultEncoding
| |
| defaultLocale | back to summary |
|---|---|
| private Locale defaultLocale
| |
| fallbackToSystemLocale | back to summary |
|---|---|
| private boolean fallbackToSystemLocale | |
| AbstractResourceBasedMessageSource | back to summary |
|---|---|
| public AbstractResourceBasedMessageSource() | |
| addBasenames | back to summary |
|---|---|
| public void addBasenames(String... basenames) Add the specified basenames to the existing basename configuration. Note If a given basename already exists, the position of its entry will remain as in the original set. New entries will be added at the end of the list, to be searched after existing basenames.
| |
| getBasenameSet | back to summary |
|---|---|
| public Set Return this Calling code may introspect this set as well as add or remove entries.
| |
| getCacheMillis | back to summary |
|---|---|
| protected long getCacheMillis() Return the number of milliseconds to cache loaded properties files.
| |
| getDefaultEncoding | back to summary |
|---|---|
| protected String getDefaultEncoding() Return the default charset to use for parsing properties files, if any.
| |
| getDefaultLocale | back to summary |
|---|---|
| protected Locale getDefaultLocale() Determine a default Locale to fall back to: either a locally specified default
Locale or the system Locale, or
| |
| isFallbackToSystemLocale | back to summary |
|---|---|
| protected boolean isFallbackToSystemLocale()
Deprecated as of 5.2.2, in favor of Return whether to fall back to the system Locale if no files for a specific Locale have been found.
| |
| setBasename | back to summary |
|---|---|
| public void setBasename(String basename) Set a single basename, following the basic ResourceBundle convention
of not specifying file extension or language codes. The resource location
format is up to the specific Regular and XMl properties files are supported: e.g. "messages" will find a "messages.properties", "messages_en.properties" etc arrangement as well as "messages.xml", "messages_en.xml" etc.
| |
| setBasenames | back to summary |
|---|---|
| public void setBasenames(String... basenames) Set an array of basenames, each following the basic ResourceBundle convention
of not specifying file extension or language codes. The resource location
format is up to the specific Regular and XMl properties files are supported: e.g. "messages" will find a "messages.properties", "messages_en.properties" etc arrangement as well as "messages.xml", "messages_en.xml" etc. The associated resource bundles will be checked sequentially when resolving a message code. Note that message definitions in a previous resource bundle will override ones in a later bundle, due to the sequential lookup. Note In contrast to
| |
| setCacheMillis | back to summary |
|---|---|
| public void setCacheMillis(long cacheMillis) Set the number of milliseconds to cache loaded properties files.
Note that it is common to set seconds instead:
| |
| setCacheSeconds | back to summary |
|---|---|
| public void setCacheSeconds(int cacheSeconds) Set the number of seconds to cache loaded properties files.
Note that depending on your ClassLoader, expiration might not work reliably
since the ClassLoader may hold on to a cached version of the bundle file.
Prefer | |
| setDefaultEncoding | back to summary |
|---|---|
| public void setDefaultEncoding(String defaultEncoding) Set the default charset to use for parsing properties files. Used if no file-specific charset is specified for a file. The effective default is the Only applies to classic properties files, not to XML files.
| |
| setDefaultLocale | back to summary |
|---|---|
| public void setDefaultLocale(Locale defaultLocale) Specify a default Locale to fall back to, as an alternative to falling back to the system Locale. Default is to fall back to the system Locale. You may override this with
a locally specified default Locale here, or enforce no fallback locale at all
through disabling
| |
| setFallbackToSystemLocale | back to summary |
|---|---|
| public void setFallbackToSystemLocale(boolean fallbackToSystemLocale) Set whether to fall back to the system Locale if no files for a specific Locale have been found. Default is "true"; if this is turned off, the only fallback will be the default file (e.g. "messages.properties" for basename "messages"). Falling back to the system Locale is the default behavior of
| |