下面列出了org.springframework.util.StringUtils#parseLocale ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
@Nullable
public Locale convert(String source) {
return StringUtils.parseLocale(source);
}
@Override
@Nullable
public Locale convert(String source) {
return StringUtils.parseLocale(source);
}
static Locale asLocale(Value value) {
return StringUtils.parseLocale(value.asString());
}
/**
* 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);
}
/**
* 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);
}
/**
* 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;
}
/**
* 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);
}
/**
* 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);
}
/**
* 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;
}