public class DateFormatterRegistrar extends java.lang.Object implements FormatterRegistrar
DateTimeFormat
declarations.
Applies to fields of type Date
, Calendar
and long
.
Designed for direct instantiation but also exposes the static
addDateConverters(ConverterRegistry)
utility method for
ad-hoc use against any ConverterRegistry
instance.
DateTimeFormatterRegistrar
,
JodaTimeFormatterRegistrar
,
FormatterRegistrar.registerFormatters(org.springframework.format.FormatterRegistry)
Modifier and Type | Class and Description |
---|---|
private static class |
DateFormatterRegistrar.CalendarToDateConverter |
private static class |
DateFormatterRegistrar.CalendarToLongConverter |
private static class |
DateFormatterRegistrar.DateToCalendarConverter |
private static class |
DateFormatterRegistrar.DateToLongConverter |
private static class |
DateFormatterRegistrar.LongToCalendarConverter |
private static class |
DateFormatterRegistrar.LongToDateConverter |
Modifier and Type | Field and Description |
---|---|
private DateFormatter |
dateFormatter |
Constructor and Description |
---|
DateFormatterRegistrar() |
Modifier and Type | Method and Description |
---|---|
static void |
addDateConverters(ConverterRegistry converterRegistry)
Add date converters to the specified registry.
|
void |
registerFormatters(FormatterRegistry registry)
Register Formatters and Converters with a FormattingConversionService
through a FormatterRegistry SPI.
|
void |
setFormatter(DateFormatter dateFormatter)
Set a global date formatter to register.
|
private DateFormatter dateFormatter
public void setFormatter(DateFormatter dateFormatter)
If not specified, no general formatter for non-annotated
Date
and Calendar
fields will be registered.
public void registerFormatters(FormatterRegistry registry)
FormatterRegistrar
registerFormatters
in interface FormatterRegistrar
registry
- the FormatterRegistry instance to use.public static void addDateConverters(ConverterRegistry converterRegistry)
converterRegistry
- the registry of converters to add to