Package dev.orne.i18n.context
Interface SharedI18nContextProvider.Builder
- All Superinterfaces:
I18nContextProvider.Builder
- All Known Implementing Classes:
SharedI18nContextProvider.BuilderImpl
- Enclosing class:
- SharedI18nContextProvider
Interface for
SharedI18nContextProvider
instance builders.- Since:
- 0.1
- Version:
- 1.0, 2024-09
- Author:
- (w) Iker Hernaez
-
Method Summary
Modifier and TypeMethodDescription@NotNull SharedI18nContextProvider.Builder
addI18nResources
(@NotNull String key, @NotNull I18nResources resource) Adds alternative I18N resources to be used when the specified key is used.@NotNull SharedI18nContextProvider
build()
Builds an immutable I18N context provider instance with the current configuration of this builder.default @NotNull SharedI18nContextProvider.Builder
Configures the builder with I18N configuration for the current class loader.@NotNull SharedI18nContextProvider.Builder
configure
(@NotNull Properties config) Configures the builder with specified I18N configuration.@NotNull SharedI18nContextProvider.Builder
setAvailableLocales
(@NotNull Locale[] locales) Sets the available locales.@NotNull SharedI18nContextProvider.Builder
setDefaultI18nResources
(@NotNull I18nResources resources) Sets the default I18N resources.@NotNull SharedI18nContextProvider.Builder
setDefaultLocaleSupplier
(@NotNull Supplier<@NotNull Locale> supplier) Sets the default locale supplier.
-
Method Details
-
configure
Configures the builder with I18N configuration for the current class loader.- Specified by:
configure
in interfaceI18nContextProvider.Builder
- Returns:
- This builder, for method chaining.
- See Also:
-
configure
Configures the builder with specified I18N configuration.- Specified by:
configure
in interfaceI18nContextProvider.Builder
- Parameters:
config
- The I18N configuration.- Returns:
- This instance, for method chaining.
-
setDefaultLocaleSupplier
@NotNull @NotNull SharedI18nContextProvider.Builder setDefaultLocaleSupplier(@NotNull @NotNull Supplier<@NotNull Locale> supplier) Sets the default locale supplier.- Specified by:
setDefaultLocaleSupplier
in interfaceI18nContextProvider.Builder
- Parameters:
supplier
- The default locale supplier.- Returns:
- This instance, for method chaining.
-
setAvailableLocales
@NotNull @NotNull SharedI18nContextProvider.Builder setAvailableLocales(@NotNull @NotNull Locale[] locales) Sets the available locales.- Specified by:
setAvailableLocales
in interfaceI18nContextProvider.Builder
- Parameters:
locales
- The available locales.- Returns:
- This instance, for method chaining.
-
setDefaultI18nResources
@NotNull @NotNull SharedI18nContextProvider.Builder setDefaultI18nResources(@NotNull @NotNull I18nResources resources) Sets the default I18N resources.- Specified by:
setDefaultI18nResources
in interfaceI18nContextProvider.Builder
- Parameters:
resources
- The default I18N resources- Returns:
- This instance, for method chaining.
-
addI18nResources
@NotNull @NotNull SharedI18nContextProvider.Builder addI18nResources(@NotNull @NotNull String key, @NotNull @NotNull I18nResources resource) Adds alternative I18N resources to be used when the specified key is used.- Specified by:
addI18nResources
in interfaceI18nContextProvider.Builder
- Parameters:
key
- The key of the alternative I18N resourcesresource
- The alternative I18N resources- Returns:
- This instance, for method chaining.
-
build
Builds an immutable I18N context provider instance with the current configuration of this builder. Further modifications to the builder will have no effect in the returned instance.- Specified by:
build
in interfaceI18nContextProvider.Builder
- Returns:
- The I18N context provider instance.
-