Class DateFormatterRegistrar
- java.lang.Object
- org.springframework.format.datetime.DateFormatterRegistrar
- All Implemented Interfaces:
FormatterRegistrar
public class DateFormatterRegistrar extends Object implements FormatterRegistrar
Configures basic date formatting for use with Spring, primarily forDateTimeFormat
declarations. Applies to fields of typeDate
,Calendar
andlong
.Designed for direct instantiation but also exposes the static
addDateConverters(ConverterRegistry)
utility method for ad-hoc use against anyConverterRegistry
instance.- Since:
- 3.2
- Author:
- Phillip Webb
- See Also:
DateTimeFormatterRegistrar
,JodaTimeFormatterRegistrar
,FormatterRegistrar.registerFormatters(org.springframework.format.FormatterRegistry)
Constructor Summary
Constructors Constructor Description DateFormatterRegistrar()
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.
Constructor Detail
DateFormatterRegistrar
public DateFormatterRegistrar()
Method Detail
setFormatter
public void setFormatter(DateFormatter dateFormatter)
registerFormatters
public void registerFormatters(FormatterRegistry registry)
Description copied from interface:FormatterRegistrar
Register Formatters and Converters with a FormattingConversionService through a FormatterRegistry SPI.- Specified by:
registerFormatters
in interfaceFormatterRegistrar
- Parameters:
registry
- the FormatterRegistry instance to use.
addDateConverters
public static void addDateConverters(ConverterRegistry converterRegistry)
Add date converters to the specified registry.- Parameters:
converterRegistry
- the registry of converters to add to