Class JodaTimeFormatterRegistrar
- java.lang.Object
- org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar
- All Implemented Interfaces:
FormatterRegistrar
public class JodaTimeFormatterRegistrar extends Object implements FormatterRegistrar
Configures Joda-Time's formatting system for use with Spring.NOTE: Spring's Joda-Time support requires Joda-Time 2.x, as of Spring 4.0.
- Since:
- 3.1
- Author:
- Keith Donald, Juergen Hoeller, Phillip Webb
- See Also:
setDateStyle(java.lang.String),setTimeStyle(java.lang.String),setDateTimeStyle(java.lang.String),setUseIsoFormat(boolean),FormatterRegistrar.registerFormatters(org.springframework.format.FormatterRegistry),DateFormatterRegistrar,DateTimeFormatterFactoryBean
Constructor Summary
Constructors Constructor Description JodaTimeFormatterRegistrar()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidregisterFormatters(FormatterRegistry registry)Register Formatters and Converters with a FormattingConversionService through a FormatterRegistry SPI.voidsetDateFormatter(DateTimeFormatter formatter)Set the formatter that will be used for objects representing date values.voidsetDateStyle(String dateStyle)Set the default format style of JodaLocalDateobjects.voidsetDateTimeFormatter(DateTimeFormatter formatter)Set the formatter that will be used for objects representing date and time values.voidsetDateTimeStyle(String dateTimeStyle)Set the default format style of JodaLocalDateTimeandDateTimeobjects, as well as JDKDateandCalendarobjects.voidsetTimeFormatter(DateTimeFormatter formatter)Set the formatter that will be used for objects representing time values.voidsetTimeStyle(String timeStyle)Set the default format style of JodaLocalTimeobjects.voidsetUseIsoFormat(boolean useIsoFormat)Set whether standard ISO formatting should be applied to all date/time types.
Constructor Detail
JodaTimeFormatterRegistrar
public JodaTimeFormatterRegistrar()
Method Detail
setUseIsoFormat
public void setUseIsoFormat(boolean useIsoFormat)
Set whether standard ISO formatting should be applied to all date/time types. Default is "false" (no).If set to "true", the "dateStyle", "timeStyle" and "dateTimeStyle" properties are effectively ignored.
setDateStyle
public void setDateStyle(String dateStyle)
Set the default format style of JodaLocalDateobjects. Default isDateTimeFormat.shortDate().
setTimeStyle
public void setTimeStyle(String timeStyle)
Set the default format style of JodaLocalTimeobjects. Default isDateTimeFormat.shortTime().
setDateTimeStyle
public void setDateTimeStyle(String dateTimeStyle)
Set the default format style of JodaLocalDateTimeandDateTimeobjects, as well as JDKDateandCalendarobjects. Default isDateTimeFormat.shortDateTime().
setDateFormatter
public void setDateFormatter(DateTimeFormatter formatter)
Set the formatter that will be used for objects representing date values.This formatter will be used for the
LocalDatetype. When specified thedateStyleanduseIsoFormatproperties will be ignored.- Parameters:
formatter- the formatter to use- Since:
- 3.2
- See Also:
setTimeFormatter(org.joda.time.format.DateTimeFormatter),setDateTimeFormatter(org.joda.time.format.DateTimeFormatter)
setTimeFormatter
public void setTimeFormatter(DateTimeFormatter formatter)
Set the formatter that will be used for objects representing time values.This formatter will be used for the
LocalTimetype. When specified thetimeStyleanduseIsoFormatproperties will be ignored.- Parameters:
formatter- the formatter to use- Since:
- 3.2
- See Also:
setDateFormatter(org.joda.time.format.DateTimeFormatter),setDateTimeFormatter(org.joda.time.format.DateTimeFormatter)
setDateTimeFormatter
public void setDateTimeFormatter(DateTimeFormatter formatter)
Set the formatter that will be used for objects representing date and time values.This formatter will be used for
LocalDateTime,ReadableInstant,DateandCalendartypes. When specified thedateTimeStyleanduseIsoFormatproperties will be ignored.- Parameters:
formatter- the formatter to use- Since:
- 3.2
- See Also:
setDateFormatter(org.joda.time.format.DateTimeFormatter),setTimeFormatter(org.joda.time.format.DateTimeFormatter)
registerFormatters
public void registerFormatters(FormatterRegistry registry)
Description copied from interface:FormatterRegistrarRegister Formatters and Converters with a FormattingConversionService through a FormatterRegistry SPI.- Specified by:
registerFormattersin interfaceFormatterRegistrar- Parameters:
registry- the FormatterRegistry instance to use.