org.springframework.ui.context.support

## 类 ResourceBundleThemeSource

- java.lang.Object
- - org.springframework.ui.context.support.ResourceBundleThemeSource

- 所有已实现的接口:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, HierarchicalThemeSource, ThemeSource

      public class ResourceBundleThemeSource
      extends Object
      implements HierarchicalThemeSource, org.springframework.beans.factory.BeanClassLoaderAware

  `ThemeSource` implementation that looks up an individual `ResourceBundle` per theme. The theme name gets interpreted as ResourceBundle basename, supporting a common basename prefix for all themes.
  作者:
    Jean-Pierre Pawlak, Juergen Hoeller
  另请参阅:
    `setBasenamePrefix(java.lang.String)`, `ResourceBundle`, `ResourceBundleMessageSource`

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `protected Log` | `logger`

  - ### 构造器概要

    构造器
    构造器和说明
    `ResourceBundleThemeSource()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected MessageSource` | `createMessageSource(String basename)` Create a MessageSource for the given basename, to be used as MessageSource for the corresponding theme.
    `ThemeSource` | `getParentThemeSource()` Return the parent of this ThemeSource, or `null` if none.
    `Theme` | `getTheme(String themeName)` This implementation returns a SimpleTheme instance, holding a ResourceBundle-based MessageSource whose basename corresponds to the given theme name (prefixed by the configured "basenamePrefix").
    `protected void` | `initParent(Theme theme)` Initialize the MessageSource of the given theme with the one from the corresponding parent of this ThemeSource.
    `void` | `setBasenamePrefix(String basenamePrefix)` Set the prefix that gets applied to the ResourceBundle basenames, i.e. the theme names.
    `void` | `setBeanClassLoader(ClassLoader beanClassLoader)`
    `void` | `setDefaultEncoding(String defaultEncoding)` Set the default charset to use for parsing resource bundle files.
    `void` | `setFallbackToSystemLocale(boolean fallbackToSystemLocale)` Set whether to fall back to the system Locale if no files for a specific Locale have been found.
    `void` | `setParentThemeSource(ThemeSource parent)` Set the parent that will be used to try to resolve theme messages that this object can't resolve.

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 字段详细资料

    - #### logger

          protected final Log logger

  - ### 构造器详细资料

    - #### ResourceBundleThemeSource

          public ResourceBundleThemeSource()

  - ### 方法详细资料

    - #### setParentThemeSource

          public void setParentThemeSource(@Nullable
                                           ThemeSource parent)

      从接口复制的说明: `HierarchicalThemeSource`
      Set the parent that will be used to try to resolve theme messages that this object can't resolve.
      指定者:
        `setParentThemeSource` 在接口中 `HierarchicalThemeSource`
      参数:
        `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.

    - #### getParentThemeSource

          @Nullable
          public ThemeSource getParentThemeSource()

      从接口复制的说明: `HierarchicalThemeSource`
      Return the parent of this ThemeSource, or `null` if none.
      指定者:
        `getParentThemeSource` 在接口中 `HierarchicalThemeSource`

    - #### setBasenamePrefix

          public void setBasenamePrefix(@Nullable
                                        String basenamePrefix)

      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.

      另请参阅:
        `ResourceBundle.getBundle(String)`

    - #### setDefaultEncoding

          public void setDefaultEncoding(@Nullable
                                         String defaultEncoding)

      Set the default charset to use for parsing resource bundle files.

      `ResourceBundleMessageSource`'s default is the `java.util.ResourceBundle` default encoding: ISO-8859-1.

      从以下版本开始:
        4.2
      另请参阅:
        `AbstractResourceBasedMessageSource.setDefaultEncoding(java.lang.String)`

    - #### setFallbackToSystemLocale

          public void setFallbackToSystemLocale(boolean fallbackToSystemLocale)

      Set whether to fall back to the system Locale if no files for a specific Locale have been found.

      `ResourceBundleMessageSource`'s default is "true".

      从以下版本开始:
        4.2
      另请参阅:
        `AbstractResourceBasedMessageSource.setFallbackToSystemLocale(boolean)`

    - #### setBeanClassLoader

          public void setBeanClassLoader(@Nullable
                                         ClassLoader beanClassLoader)

      指定者:
        `setBeanClassLoader` 在接口中 `org.springframework.beans.factory.BeanClassLoaderAware`

    - #### getTheme

          @Nullable
          public Theme getTheme(String themeName)

      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.

      指定者:
        `getTheme` 在接口中 `ThemeSource`
      参数:
        `themeName` - the name of the theme
      返回:
        the corresponding Theme, or `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.
      另请参阅:
        `setBasenamePrefix(java.lang.String)`, `createMessageSource(java.lang.String)`

    - #### createMessageSource

          protected MessageSource createMessageSource(String basename)

      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
      返回:
        the MessageSource
      另请参阅:
        `ResourceBundleMessageSource`, `ReloadableResourceBundleMessageSource`

    - #### initParent

          protected void initParent(Theme theme)

      Initialize the MessageSource of the given theme with the one from the corresponding parent of this ThemeSource.
      参数:
        `theme` - the Theme to (re-)initialize