Polishing
This commit is contained in:
@@ -1095,7 +1095,7 @@ The `number` package provides a `NumberFormatter`, `CurrencyFormatter`, and
|
||||
`PercentFormatter` to format `java.lang.Number` objects using a `java.text.NumberFormat`.
|
||||
The `datetime` package provides a `DateFormatter` to format `java.util.Date` objects with
|
||||
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].
|
||||
|
||||
Consider `DateFormatter` as an example `Formatter` implementation:
|
||||
|
||||
@@ -1227,7 +1227,7 @@ To trigger formatting, simply annotate fields with @NumberFormat:
|
||||
==== Format Annotation API
|
||||
A portable format annotation API exists in the `org.springframework.format.annotation`
|
||||
package. Use @NumberFormat to format java.lang.Number fields. Use @DateTimeFormat to
|
||||
format java.util.Date, java.util.Calendar, java.util.Long, or Joda Time fields.
|
||||
format java.util.Date, java.util.Calendar, java.util.Long, or Joda-Time fields.
|
||||
|
||||
The example below uses @DateTimeFormat to format a java.util.Date as a ISO Date
|
||||
(yyyy-MM-dd):
|
||||
@@ -1328,10 +1328,10 @@ You will need to ensure that Spring does not register default formatters, and in
|
||||
you should register all formatters manually. Use the
|
||||
`org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar` or
|
||||
`org.springframework.format.datetime.DateFormatterRegistrar` class depending on whether
|
||||
you use the Joda Time library.
|
||||
you use the Joda-Time library.
|
||||
|
||||
For example, the following Java configuration will register a global ' `yyyyMMdd`'
|
||||
format. This example does not depend on the Joda Time library:
|
||||
format. This example does not depend on the Joda-Time library:
|
||||
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
@@ -1396,7 +1396,7 @@ Time:
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
Joda Time provides separate distinct types to represent `date`, `time` and `date-time`
|
||||
Joda-Time provides separate distinct types to represent `date`, `time` and `date-time`
|
||||
values. The `dateFormatter`, `timeFormatter` and `dateTimeFormatter` properties of the
|
||||
`JodaTimeFormatterRegistrar` should be used to configure the different formats for each
|
||||
type. The `DateTimeFormatterFactoryBean` provides a convenient way to create formatters.
|
||||
|
||||
@@ -4841,7 +4841,7 @@ It also enables the following:
|
||||
in addition to the JavaBeans PropertyEditors used for Data Binding.
|
||||
. Support for <<format,formatting>> Number fields using the `@NumberFormat` annotation
|
||||
through the `ConversionService`.
|
||||
. Support for <<format,formatting>> `Date`, `Calendar`, `Long`, and Joda Time fields using the
|
||||
. Support for <<format,formatting>> `Date`, `Calendar`, `Long`, and Joda-Time fields using the
|
||||
`@DateTimeFormat` annotation.
|
||||
. Support for <<mvc-config-validation,validating>> `@Controller` inputs with `@Valid`, if
|
||||
a JSR-303 Provider is present on the classpath.
|
||||
@@ -4925,8 +4925,8 @@ available.
|
||||
=== Conversion and Formatting
|
||||
|
||||
By default formatters for `Number` and `Date` types are installed, including support for
|
||||
the `@NumberFormat` and `@DateTimeFormat` annotations. Full support for the Joda Time
|
||||
formatting library is also installed if Joda Time is present on the classpath. To
|
||||
the `@NumberFormat` and `@DateTimeFormat` annotations. Full support for the Joda-Time
|
||||
formatting library is also installed if Joda-Time is present on the classpath. To
|
||||
register custom formatters and converters, override the `addFormatters` method:
|
||||
|
||||
[source,java,indent=0]
|
||||
|
||||
Reference in New Issue
Block a user