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