public class JodaTimeFormatterRegistrar extends Object implements FormatterRegistrar
NOTE: Spring's Joda-Time support requires Joda-Time 2.x, as of Spring 4.0.
setDateStyle(java.lang.String),
setTimeStyle(java.lang.String),
setDateTimeStyle(java.lang.String),
setUseIsoFormat(boolean),
FormatterRegistrar.registerFormatters(org.springframework.format.FormatterRegistry),
DateFormatterRegistrar,
DateTimeFormatterFactoryBean| Constructor and Description |
|---|
JodaTimeFormatterRegistrar() |
| Modifier and Type | Method and Description |
|---|---|
void |
registerFormatters(FormatterRegistry registry)
Register Formatters and Converters with a FormattingConversionService
through a FormatterRegistry SPI.
|
void |
setDateFormatter(DateTimeFormatter formatter)
Set the formatter that will be used for objects representing date values.
|
void |
setDateStyle(String dateStyle)
Set the default format style of Joda
LocalDate objects. |
void |
setDateTimeFormatter(DateTimeFormatter formatter)
Set the formatter that will be used for objects representing date and time values.
|
void |
setDateTimeStyle(String dateTimeStyle)
Set the default format style of Joda
LocalDateTime and DateTime objects,
as well as JDK Date and Calendar objects. |
void |
setTimeFormatter(DateTimeFormatter formatter)
Set the formatter that will be used for objects representing time values.
|
void |
setTimeStyle(String timeStyle)
Set the default format style of Joda
LocalTime objects. |
void |
setUseIsoFormat(boolean useIsoFormat)
Set whether standard ISO formatting should be applied to all date/time types.
|
public void setUseIsoFormat(boolean useIsoFormat)
If set to "true", the "dateStyle", "timeStyle" and "dateTimeStyle" properties are effectively ignored.
public void setDateStyle(String dateStyle)
LocalDate objects.
Default is DateTimeFormat.shortDate().public void setTimeStyle(String timeStyle)
LocalTime objects.
Default is DateTimeFormat.shortTime().public void setDateTimeStyle(String dateTimeStyle)
LocalDateTime and DateTime objects,
as well as JDK Date and Calendar objects.
Default is DateTimeFormat.shortDateTime().public void setDateFormatter(DateTimeFormatter formatter)
This formatter will be used for the LocalDate type. When specified
the dateStyle and
useIsoFormat properties will be ignored.
formatter - the formatter to usesetTimeFormatter(org.joda.time.format.DateTimeFormatter),
setDateTimeFormatter(org.joda.time.format.DateTimeFormatter)public void setTimeFormatter(DateTimeFormatter formatter)
This formatter will be used for the LocalTime type. When specified
the timeStyle and
useIsoFormat properties will be ignored.
formatter - the formatter to usesetDateFormatter(org.joda.time.format.DateTimeFormatter),
setDateTimeFormatter(org.joda.time.format.DateTimeFormatter)public void setDateTimeFormatter(DateTimeFormatter formatter)
This formatter will be used for LocalDateTime, ReadableInstant,
Date and Calendar types. When specified
the dateTimeStyle and
useIsoFormat properties will be ignored.
formatter - the formatter to usesetDateFormatter(org.joda.time.format.DateTimeFormatter),
setTimeFormatter(org.joda.time.format.DateTimeFormatter)public void registerFormatters(FormatterRegistry registry)
FormatterRegistrarregisterFormatters in interface FormatterRegistrarregistry - the FormatterRegistry instance to use.