Package dev.orne.i18n.context
Interface ThreadI18nContextProvider.Builder
- All Superinterfaces:
I18nContextProvider.Builder
- All Known Subinterfaces:
I18nSpringContextProvider.Builder
- All Known Implementing Classes:
I18nSpringContextProvider.BuilderImpl
,ThreadI18nContextProvider.BuilderImpl
- Enclosing class:
- ThreadI18nContextProvider
Interface for
ThreadI18nContextProvider
instance builders.- Since:
- 0.1
- Version:
- 1.0, 2024-09
- Author:
- (w) Iker Hernaez
-
Method Summary
Modifier and TypeMethodDescription@NotNull ThreadI18nContextProvider.Builder
addI18nResources
(@NotNull String key, @NotNull I18nResources resource) Adds alternative I18N resources to be used when the specified key is used.@NotNull ThreadI18nContextProvider
build()
Builds an immutable I18N context provider instance with the current configuration of this builder.default @NotNull ThreadI18nContextProvider.Builder
Configures the builder with I18N configuration for the current class loader.@NotNull ThreadI18nContextProvider.Builder
configure
(@NotNull Properties config) Configures the builder with specified I18N configuration.@NotNull ThreadI18nContextProvider.Builder
setAvailableLocales
(@NotNull Locale[] locales) Sets the available locales.@NotNull ThreadI18nContextProvider.Builder
setDefaultI18nResources
(@NotNull I18nResources resources) Sets the default I18N resources.@NotNull ThreadI18nContextProvider.Builder
setDefaultLocaleSupplier
(@NotNull Supplier<@NotNull Locale> supplier) Sets the default locale supplier.@NotNull ThreadI18nContextProvider.Builder
setInheritableContexts
(@javax.validation.constraints.NotNull boolean inheritable) Sets if theI18nContext
instances will be inherited by child threads.
-
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 ThreadI18nContextProvider.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 ThreadI18nContextProvider.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 ThreadI18nContextProvider.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 ThreadI18nContextProvider.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.
-
setInheritableContexts
@NotNull @NotNull ThreadI18nContextProvider.Builder setInheritableContexts(@NotNull @javax.validation.constraints.NotNull boolean inheritable) Sets if theI18nContext
instances will be inherited by child threads.- Parameters:
inheritable
- If theI18nContext
instances will be inherited by child threads.- Returns:
- This builder, 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.
-