in locales-common/src/main/java/com/spotify/i18n/locales/common/impl/LocalesHelpersFactoryBaseImpl.java [155:204]
public abstract Builder contextToAudience(
final Function<CONTEXT, CompletionStage<AUDIENCE>> contextToAudience);
/**
* Configures the function that returns the {@link SupportedLocalesSupplier} for the given
* {@link AUDIENCE}.
*
* @param audienceToSupportedLocalesSupplier the function as described above
* @return The {@link Builder} instance
*/
public abstract Builder audienceToSupportedLocalesSupplier(
final Function<AUDIENCE, SupportedLocalesSupplier> audienceToSupportedLocalesSupplier);
/**
* Configures the function that returns a new CompletionStage that, when this stage completes
* normally, returns the optional {@code Accept-Language} value for the {@link CONTEXT}.
*
* @param contextToAcceptLanguage the function as described above
* @return The {@link Builder} instance
*/
public abstract Builder contextToAcceptLanguage(
final Function<CONTEXT, CompletionStage<Optional<String>>> contextToAcceptLanguage);
/**
* Configures the function that returns a new CompletionStage that, when this stage completes
* normally, returns the default {@link ResolvedLocale}, for a given {@link CONTEXT}.
*
* <p>This {@link ResolvedLocale} should be considered as the default/fallback resolved locale,
* in case locale resolution fails to find a matching supported locale for that given {@link
* CONTEXT}.
*
* <p>A base implementation of this function could be to map any {@link CONTEXT} to a unique
* {@link ResolvedLocale} matching your default application language.
*
* @param contextToDefaultResolvedLocale the function as described above
* @return The {@link Builder} instance
*/
public abstract Builder contextToDefaultResolvedLocale(
final Function<CONTEXT, CompletionStage<ResolvedLocale>> contextToDefaultResolvedLocale);
abstract LocalesHelpersFactoryBaseImpl<CONTEXT, AUDIENCE> autoBuild();
/**
* Returns a built {@link LocalesHelpersFactory<CONTEXT>} based on the builder properties.
*
* @return built locales helpers factory
*/
public final LocalesHelpersFactory<CONTEXT> build() {
return autoBuild();
}