Package dev.orne.i18n.context
Interface I18nContextProvider.Builder
- All Known Subinterfaces:
I18nSpringContextProvider.Builder
,SharedI18nContextProvider.Builder
,ThreadI18nContextProvider.Builder
- All Known Implementing Classes:
I18nSpringContextProvider.BuilderImpl
,SharedI18nContextProvider.BuilderImpl
,ThreadI18nContextProvider.BuilderImpl
- Enclosing interface:
- I18nContextProvider
@API(status=STABLE,
since="0.1")
public static interface I18nContextProvider.Builder
Builder of I18N context provider instances.
- Since:
- 0.1
- Version:
- 1.0, 2024-09
- Author:
- (w) Iker Hernaez
-
Method Summary
Modifier and TypeMethodDescription@NotNull I18nContextProvider.Builder
addI18nResources
(@NotNull String key, @NotNull I18nResources resource) Adds alternative I18N resources to be used when the specified key is used.@NotNull I18nContextProvider
build()
Builds an immutable I18N context provider instance with the current configuration of this builder.default @NotNull I18nContextProvider.Builder
Configures the builder with I18N configuration for the current class loader.@NotNull I18nContextProvider.Builder
configure
(@NotNull Properties config) Configures the builder with specified I18N configuration.@NotNull I18nContextProvider.Builder
setAvailableLocales
(@NotNull Locale[] locales) Sets the available locales.@NotNull I18nContextProvider.Builder
setDefaultI18nResources
(@NotNull I18nResources resources) Sets the default I18N resources.@NotNull I18nContextProvider.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.- Returns:
- This builder, for method chaining.
- See Also:
-
configure
Configures the builder with specified I18N configuration.- Parameters:
config
- The I18N configuration.- Returns:
- This instance, for method chaining.
-
setDefaultLocaleSupplier
@NotNull @NotNull I18nContextProvider.Builder setDefaultLocaleSupplier(@NotNull @NotNull Supplier<@NotNull Locale> supplier) Sets the default locale supplier.- Parameters:
supplier
- The default locale supplier.- Returns:
- This instance, for method chaining.
-
setAvailableLocales
@NotNull @NotNull I18nContextProvider.Builder setAvailableLocales(@NotNull @NotNull Locale[] locales) Sets the available locales.- Parameters:
locales
- The available locales.- Returns:
- This instance, for method chaining.
-
setDefaultI18nResources
@NotNull @NotNull I18nContextProvider.Builder setDefaultI18nResources(@NotNull @NotNull I18nResources resources) Sets the default I18N resources.- Parameters:
resources
- The default I18N resources- Returns:
- This instance, for method chaining.
-
addI18nResources
@NotNull @NotNull I18nContextProvider.Builder 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 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.- Returns:
- The I18N context provider instance.
-