Package dev.orne.i18n.context
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 Summary
Modifier and TypeFieldDescriptionprotected @NotNull Locale[]
The supported languages.protected @NotNull I18nResources
The default I18N resources.The default language supplier.protected final @NotNull Map<@NotNull String,
@NotNull I18nResources> The alternative I18N resources by key. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddI18nResources
(@NotNull String key, @NotNull I18nResources resource) Adds alternative I18N resources to be used when the specified key is used.configure
(@NotNull Properties config) Configures the builder with specified I18N configuration.protected void
configureAlternativeI18nResources
(@NotNull Properties config) Configures the alternative I18N resources based on specified configuration.protected void
configureAvailableLocalesSupplier
(@NotNull Properties config) Configures the supported languages based on specified configuration.protected void
configureDefaultI18nResources
(@NotNull Properties config) Configures the default I18N resources based on specified configuration.protected void
configureDefaultLocaleSupplier
(@NotNull Properties config) Configures the default language based on specified configuration.setAvailableLocales
(@NotNull Locale[] locales) Sets the available locales.setDefaultI18nResources
(@NotNull I18nResources resources) Sets the default I18N resources.setDefaultLocaleSupplier
(@NotNull Supplier<@NotNull Locale> supplier) Sets the default locale supplier.
-
Field Details
-
defaultLocaleSupplier
The default language supplier. -
availableLocales
The supported languages. -
defaultI18nResources
The default I18N resources. -
i18nResources
The alternative I18N resources by key.
-
-
Constructor Details
-
BuilderImpl
protected BuilderImpl()Creates a new instance.
-
-
Method Details
-
configure
Configures the builder with specified I18N configuration.- Parameters:
config
- The I18N configuration.- Returns:
- This builder, for method chaining.
- See Also:
-
configureDefaultLocaleSupplier
Configures the default language based on specified configuration.- Parameters:
config
- The I18N configuration.
-
configureAvailableLocalesSupplier
Configures the supported languages based on specified configuration.- Parameters:
config
- The I18N configuration.
-
configureDefaultI18nResources
Configures the default I18N resources based on specified configuration.- Parameters:
config
- The I18N configuration.
-
configureAlternativeI18nResources
Configures the alternative I18N resources based on specified configuration.- Parameters:
config
- The I18N configuration.
-
setDefaultLocaleSupplier
Sets the default locale supplier.- Parameters:
supplier
- The default locale supplier.- Returns:
- This instance, for method chaining.
- See Also:
-
setAvailableLocales
Sets the available locales.- Parameters:
locales
- The available locales.- Returns:
- This instance, for method chaining.
- See Also:
-
setDefaultI18nResources
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 resourcesresource
- The alternative I18N resources- Returns:
- This instance, for method chaining.
- See Also:
-