java.lang.Object | |
↳ | org.springframework.ui.context.support.ResourceBundleThemeSource |
ThemeSource
implementation that looks up an individual
java.util.ResourceBundle per theme. The theme name gets
interpreted as ResourceBundle basename, supporting a common
basename prefix for all themes.
setBasenamePrefix(String)
ResourceBundleMessageSource
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
logger |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return the parent of this ThemeSource, or
null if none. | |||||||||||
This implementation returns a SimpleTheme instance, holding a
ResourceBundle-based MessageSource whose basename corresponds to
the given theme name (prefixed by the configured "basenamePrefix").
| |||||||||||
Set the prefix that gets applied to the ResourceBundle basenames,
i.e.
| |||||||||||
Set the parent that will be used to try to resolve theme messages
that this object can't resolve.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a MessageSource for the given basename,
to be used as MessageSource for the corresponding theme.
| |||||||||||
Initialize the MessageSource of the given theme with the
one from the corresponding parent of this ThemeSource.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.ui.context.HierarchicalThemeSource
| |||||||||||
From interface
org.springframework.ui.context.ThemeSource
|
This implementation returns a SimpleTheme instance, holding a ResourceBundle-based MessageSource whose basename corresponds to the given theme name (prefixed by the configured "basenamePrefix").
SimpleTheme instances are cached per theme name. Use a reloadable MessageSource if themes should reflect changes to the underlying files.
themeName | the name of the theme |
---|
null
if none defined.
Note that, by convention, a ThemeSource should at least be able to
return a default Theme for the default theme name "theme" but may also
return default Themes for other theme names.Set the prefix that gets applied to the ResourceBundle basenames, i.e. the theme names. E.g.: basenamePrefix="test.", themeName="theme" -> basename="test.theme".
Note that ResourceBundle names are effectively classpath locations: As a
consequence, the JDK's standard ResourceBundle treats dots as package separators.
This means that "test.theme" is effectively equivalent to "test/theme",
just like it is for programmatic java.util.ResourceBundle
usage.
Set the parent that will be used to try to resolve theme messages that this object can't resolve.
parent | the parent ThemeSource that will be used to
resolve messages that this object can't resolve.
May be null , in which case no further resolution is possible.
|
---|
Create a MessageSource for the given basename, to be used as MessageSource for the corresponding theme.
Default implementation creates a ResourceBundleMessageSource. for the given basename. A subclass could create a specifically configured ReloadableResourceBundleMessageSource, for example.
basename | the basename to create a MessageSource for |
---|
Initialize the MessageSource of the given theme with the one from the corresponding parent of this ThemeSource.
theme | the Theme to (re-)initialize |
---|