public class JodaTimeFormatterRegistrar extends java.lang.Object implements FormatterRegistrar
setDateStyle(java.lang.String),
setTimeStyle(java.lang.String),
setDateTimeStyle(java.lang.String),
setUseIsoFormat(boolean),
FormatterRegistrar.registerFormatters(org.springframework.format.FormatterRegistry),
DateFormatterRegistrar| Modifier and Type | Class and Description |
|---|---|
private static class |
JodaTimeFormatterRegistrar.Type |
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<JodaTimeFormatterRegistrar.Type,DateTimeFormatterFactory> |
factories
Factories used when specific formatters have not been specified.
|
private java.util.Map<JodaTimeFormatterRegistrar.Type,DateTimeFormatter> |
formatters
User defined formatters.
|
| Constructor and Description |
|---|
JodaTimeFormatterRegistrar() |
| Modifier and Type | Method and Description |
|---|---|
private void |
addFormatterForFields(FormatterRegistry registry,
Printer<?> printer,
Parser<?> parser,
java.lang.Class<?>... fieldTypes) |
private DateTimeFormatter |
getFallbackFormatter(JodaTimeFormatterRegistrar.Type type) |
private DateTimeFormatter |
getFormatter(JodaTimeFormatterRegistrar.Type type) |
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(java.lang.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(java.lang.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 date values.
|
void |
setTimeStyle(java.lang.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.
|
private java.util.Map<JodaTimeFormatterRegistrar.Type,DateTimeFormatter> formatters
private java.util.Map<JodaTimeFormatterRegistrar.Type,DateTimeFormatterFactory> factories
public void setDateStyle(java.lang.String dateStyle)
LocalDate objects.
Default is DateTimeFormat#shortDate().public void setTimeStyle(java.lang.String timeStyle)
LocalTime objects.
Default is DateTimeFormat#shortTime().public void setDateTimeStyle(java.lang.String dateTimeStyle)
LocalDateTime and DateTime objects,
as well as JDK Date and Calendar objects.
Default is DateTimeFormat#shortDateTime().public void setUseIsoFormat(boolean useIsoFormat)
public void setDateFormatter(DateTimeFormatter formatter)
LocalDate type. When specified
dateStyle and
useIsoFormat properties will be ignored.formatter - the formatter to usesetTimeFormatter(DateTimeFormatter),
setDateTimeFormatter(DateTimeFormatter)public void setTimeFormatter(DateTimeFormatter formatter)
LocalTime type. When specified
timeStyle and
useIsoFormat properties will be ignored.formatter - the formatter to usesetDateFormatter(DateTimeFormatter),
setDateTimeFormatter(DateTimeFormatter)public void setDateTimeFormatter(DateTimeFormatter formatter)
LocalDateTime, ReadableInstant,
Date and Calendar types. When specified
dateTimeStyle and
useIsoFormat properties will be ignored.formatter - the formatter to usesetDateFormatter(DateTimeFormatter),
setTimeFormatter(DateTimeFormatter)public void registerFormatters(FormatterRegistry registry)
FormatterRegistrarregisterFormatters in interface FormatterRegistrarregistry - the FormatterRegistry instance to use.private DateTimeFormatter getFormatter(JodaTimeFormatterRegistrar.Type type)
private DateTimeFormatter getFallbackFormatter(JodaTimeFormatterRegistrar.Type type)
private void addFormatterForFields(FormatterRegistry registry, Printer<?> printer, Parser<?> parser, java.lang.Class<?>... fieldTypes)