提交 39d45507 编写于 作者: J Juergen Hoeller

Update ref doc references to Number/Currency/PercentStyleFormatter

Issue: SPR-17022
上级 833343f1
...@@ -1102,8 +1102,8 @@ should throw a ParseException or IllegalArgumentException if a parse attempt fai ...@@ -1102,8 +1102,8 @@ should throw a ParseException or IllegalArgumentException if a parse attempt fai
care to ensure your Formatter implementation is thread-safe. care to ensure your Formatter implementation is thread-safe.
Several Formatter implementations are provided in `format` subpackages as a convenience. Several Formatter implementations are provided in `format` subpackages as a convenience.
The `number` package provides a `NumberFormatter`, `CurrencyFormatter`, and The `number` package provides a `NumberStyleFormatter`, `CurrencyStyleFormatter`, and
`PercentFormatter` to format `java.lang.Number` objects using a `java.text.NumberFormat`. `PercentStyleFormatter` to format `java.lang.Number` objects using a `java.text.NumberFormat`.
The `datetime` package provides a `DateFormatter` to format `java.util.Date` objects with The `datetime` package provides a `DateFormatter` to format `java.util.Date` objects with
a `java.text.DateFormat`. The `datetime.joda` package provides comprehensive datetime a `java.text.DateFormat`. The `datetime.joda` package provides comprehensive datetime
formatting support based on the http://joda-time.sourceforge.net[Joda-Time library]. formatting support based on the http://joda-time.sourceforge.net[Joda-Time library].
...@@ -1203,18 +1203,17 @@ specified: ...@@ -1203,18 +1203,17 @@ specified:
return configureFormatterFrom(annotation, fieldType); return configureFormatterFrom(annotation, fieldType);
} }
private Formatter<Number> configureFormatterFrom(NumberFormat annotation, private Formatter<Number> configureFormatterFrom(NumberFormat annotation, Class<?> fieldType) {
Class<?> fieldType) {
if (!annotation.pattern().isEmpty()) { if (!annotation.pattern().isEmpty()) {
return new NumberFormatter(annotation.pattern()); return new NumberStyleFormatter(annotation.pattern());
} else { } else {
Style style = annotation.style(); Style style = annotation.style();
if (style == Style.PERCENT) { if (style == Style.PERCENT) {
return new PercentFormatter(); return new PercentStyleFormatter();
} else if (style == Style.CURRENCY) { } else if (style == Style.CURRENCY) {
return new CurrencyFormatter(); return new CurrencyStyleFormatter();
} else { } else {
return new NumberFormatter(); return new NumberStyleFormatter();
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册