Java Code Examples for org.springframework.util.StringUtils#parseLocale()

The following examples show how to use org.springframework.util.StringUtils#parseLocale() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StringToLocaleConverter.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
@Nullable
public Locale convert(String source) {
	return StringUtils.parseLocale(source);
}
 
Example 2
Source File: StringToLocaleConverter.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
@Nullable
public Locale convert(String source) {
	return StringUtils.parseLocale(source);
}
 
Example 3
Source File: AdditionalTypes.java    From sdn-rx with Apache License 2.0 2 votes vote down vote up
static Locale asLocale(Value value) {

		return StringUtils.parseLocale(value.asString());
	}
 
Example 4
Source File: CookieLocaleResolver.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Parse the given locale value coming from an incoming cookie.
 * <p>The default implementation calls {@link StringUtils#parseLocale(String)},
 * accepting the {@link Locale#toString} format as well as BCP 47 language tags.
 * @param localeValue the locale value to parse
 * @return the corresponding {@code Locale} instance
 * @since 4.3
 * @see StringUtils#parseLocale(String)
 */
@Nullable
protected Locale parseLocaleValue(String localeValue) {
	return StringUtils.parseLocale(localeValue);
}
 
Example 5
Source File: LocaleChangeInterceptor.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Parse the given locale value as coming from a request parameter.
 * <p>The default implementation calls {@link StringUtils#parseLocale(String)},
 * accepting the {@link Locale#toString} format as well as BCP 47 language tags.
 * @param localeValue the locale value to parse
 * @return the corresponding {@code Locale} instance
 * @since 4.3
 */
@Nullable
protected Locale parseLocaleValue(String localeValue) {
	return StringUtils.parseLocale(localeValue);
}
 
Example 6
Source File: Jackson2ObjectMapperBuilder.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Override the default {@link Locale} to use for formatting.
 * Default value used is {@link Locale#getDefault()}.
 * @param localeString the locale ID as a String representation
 * @since 4.1.5
 */
public Jackson2ObjectMapperBuilder locale(String localeString) {
	this.locale = StringUtils.parseLocale(localeString);
	return this;
}
 
Example 7
Source File: CookieLocaleResolver.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Parse the given locale value coming from an incoming cookie.
 * <p>The default implementation calls {@link StringUtils#parseLocale(String)},
 * accepting the {@link Locale#toString} format as well as BCP 47 language tags.
 * @param localeValue the locale value to parse
 * @return the corresponding {@code Locale} instance
 * @since 4.3
 * @see StringUtils#parseLocale(String)
 */
@Nullable
protected Locale parseLocaleValue(String localeValue) {
	return StringUtils.parseLocale(localeValue);
}
 
Example 8
Source File: LocaleChangeInterceptor.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Parse the given locale value as coming from a request parameter.
 * <p>The default implementation calls {@link StringUtils#parseLocale(String)},
 * accepting the {@link Locale#toString} format as well as BCP 47 language tags.
 * @param localeValue the locale value to parse
 * @return the corresponding {@code Locale} instance
 * @since 4.3
 */
@Nullable
protected Locale parseLocaleValue(String localeValue) {
	return StringUtils.parseLocale(localeValue);
}
 
Example 9
Source File: Jackson2ObjectMapperBuilder.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Override the default {@link Locale} to use for formatting.
 * Default value used is {@link Locale#getDefault()}.
 * @param localeString the locale ID as a String representation
 * @since 4.1.5
 */
public Jackson2ObjectMapperBuilder locale(String localeString) {
	this.locale = StringUtils.parseLocale(localeString);
	return this;
}