Package dev.orne.i18n.context
Class ThreadI18nContextProvider.BuilderImpl<T extends ThreadI18nContextProvider,B extends ThreadI18nContextProvider.BuilderImpl<T,B>>
java.lang.Object
dev.orne.i18n.context.AbstractI18nContextProvider.BuilderImpl<T,B>
dev.orne.i18n.context.ThreadI18nContextProvider.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.
- All Implemented Interfaces:
I18nContextProvider.Builder
,ThreadI18nContextProvider.Builder
- Direct Known Subclasses:
I18nSpringContextProvider.BuilderImpl
- Enclosing class:
- ThreadI18nContextProvider
protected static class ThreadI18nContextProvider.BuilderImpl<T extends ThreadI18nContextProvider,B extends ThreadI18nContextProvider.BuilderImpl<T,B>>
extends AbstractI18nContextProvider.BuilderImpl<T,B>
implements ThreadI18nContextProvider.Builder
Abstract builder of
ThreadI18nContextProvider
instances.- Since:
- 0.1
- Version:
- 1.0, 2024-09
- Author:
- (w) Iker Hernaez
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
If theI18nContext
instances should be inherited by childThread
s.Fields inherited from class dev.orne.i18n.context.AbstractI18nContextProvider.BuilderImpl
availableLocales, defaultI18nResources, defaultLocaleSupplier, i18nResources
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull ThreadI18nContextProvider
build()
Builds an immutable I18N context provider instance with the current configuration of this builder.configure
(@NotNull Properties config) Configures the builder with specified I18N configuration.protected void
configureInheritable
(@NotNull Properties config) Configures the default language based on specified configuration.setInheritableContexts
(@javax.validation.constraints.NotNull boolean inheritable) Sets if theI18nContext
instances will be inherited by child threads.Methods inherited from class dev.orne.i18n.context.AbstractI18nContextProvider.BuilderImpl
addI18nResources, configureAlternativeI18nResources, configureAvailableLocalesSupplier, configureDefaultI18nResources, configureDefaultLocaleSupplier, setAvailableLocales, setDefaultI18nResources, setDefaultLocaleSupplier
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.orne.i18n.context.ThreadI18nContextProvider.Builder
addI18nResources, configure, setAvailableLocales, setDefaultI18nResources, setDefaultLocaleSupplier
-
Field Details
-
inheritableContexts
protected boolean inheritableContextsIf theI18nContext
instances should be inherited by childThread
s.
-
-
Constructor Details
-
BuilderImpl
protected BuilderImpl()Creates a new instance.
-
-
Method Details
-
configure
Configures the builder with specified I18N configuration.- Specified by:
configure
in interfaceI18nContextProvider.Builder
- Specified by:
configure
in interfaceThreadI18nContextProvider.Builder
- Overrides:
configure
in classAbstractI18nContextProvider.BuilderImpl<T extends ThreadI18nContextProvider,
B extends ThreadI18nContextProvider.BuilderImpl<T, B>> - Parameters:
config
- The I18N configuration.- Returns:
- This builder, for method chaining.
- See Also:
-
configureInheritable
Configures the default language based on specified configuration.- Parameters:
config
- The I18N configuration.
-
setInheritableContexts
@NotNull public B 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.
-