Class AbstractI18nContextProvider.BuilderImpl<T extends AbstractI18nContextProvider,B extends AbstractI18nContextProvider.BuilderImpl<T,B>>

java.lang.Object
dev.orne.i18n.context.AbstractI18nContextProvider.BuilderImpl<T,B>
Type Parameters:
T - The type of I18N context provider build by the builder.
B - The type of builder returned for method chaining.
Direct Known Subclasses:
SharedI18nContextProvider.BuilderImpl, ThreadI18nContextProvider.BuilderImpl
Enclosing class:
AbstractI18nContextProvider

protected abstract static class AbstractI18nContextProvider.BuilderImpl<T extends AbstractI18nContextProvider,B extends AbstractI18nContextProvider.BuilderImpl<T,B>> extends Object
Abstract builder of I18N context provider instances.
Since:
0.1
Version:
1.0, 2024-09
Author:
(w) Iker Hernaez
  • Field Details

    • defaultLocaleSupplier

      @NotNull protected @NotNull Supplier<@NotNull Locale> defaultLocaleSupplier
      The default language supplier.
    • availableLocales

      @NotNull protected @NotNull Locale[] availableLocales
      The supported languages.
    • defaultI18nResources

      @NotNull protected @NotNull I18nResources defaultI18nResources
      The default I18N resources.
    • i18nResources

      @NotNull protected final @NotNull Map<@NotNull String,@NotNull I18nResources> i18nResources
      The alternative I18N resources by key.
  • Constructor Details

    • BuilderImpl

      protected BuilderImpl()
      Creates a new instance.
  • Method Details

    • configure

      @NotNull public B configure(@NotNull @NotNull Properties config)
      Configures the builder with specified I18N configuration.
      Parameters:
      config - The I18N configuration.
      Returns:
      This builder, for method chaining.
      See Also:
    • configureDefaultLocaleSupplier

      protected void configureDefaultLocaleSupplier(@NotNull @NotNull Properties config)
      Configures the default language based on specified configuration.
      Parameters:
      config - The I18N configuration.
    • configureAvailableLocalesSupplier

      protected void configureAvailableLocalesSupplier(@NotNull @NotNull Properties config)
      Configures the supported languages based on specified configuration.
      Parameters:
      config - The I18N configuration.
    • configureDefaultI18nResources

      protected void configureDefaultI18nResources(@NotNull @NotNull Properties config)
      Configures the default I18N resources based on specified configuration.
      Parameters:
      config - The I18N configuration.
    • configureAlternativeI18nResources

      protected void configureAlternativeI18nResources(@NotNull @NotNull Properties config)
      Configures the alternative I18N resources based on specified configuration.
      Parameters:
      config - The I18N configuration.
    • setDefaultLocaleSupplier

      @NotNull public B setDefaultLocaleSupplier(@NotNull @NotNull Supplier<@NotNull Locale> supplier)
      Sets the default locale supplier.
      Parameters:
      supplier - The default locale supplier.
      Returns:
      This instance, for method chaining.
      See Also:
    • setAvailableLocales

      @NotNull public B setAvailableLocales(@NotNull @NotNull Locale[] locales)
      Sets the available locales.
      Parameters:
      locales - The available locales.
      Returns:
      This instance, for method chaining.
      See Also:
    • setDefaultI18nResources

      @NotNull public B setDefaultI18nResources(@NotNull @NotNull I18nResources resources)
      Sets the default I18N resources.
      Parameters:
      resources - The default I18N resources
      Returns:
      This instance, for method chaining.
      See Also:
    • addI18nResources

      @NotNull public B addI18nResources(@NotNull @NotNull String key, @NotNull @NotNull I18nResources resource)
      Adds alternative I18N resources to be used when the specified key is used.
      Parameters:
      key - The key of the alternative I18N resources
      resource - The alternative I18N resources
      Returns:
      This instance, for method chaining.
      See Also: