org.springframework.format.datetime.joda

## 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.
  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 and Description
    `JodaTimeFormatterRegistrar()`

  - ### Method Summary

    Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JodaTimeFormatterRegistrar

          public JodaTimeFormatterRegistrar()

  - ### Method Detail

    - #### setDateStyle

          public void setDateStyle(String dateStyle)

      Set the default format style of Joda `LocalDate` objects. Default is `DateTimeFormat.shortDate()`.

    - #### setTimeStyle

          public void setTimeStyle(String timeStyle)

      Set the default format style of Joda `LocalTime` objects. Default is `DateTimeFormat.shortTime()`.

    - #### setDateTimeStyle

          public void setDateTimeStyle(String dateTimeStyle)

      Set the default format style of Joda `LocalDateTime` and `DateTime` objects, as well as JDK `Date` and `Calendar` objects. Default is `DateTimeFormat.shortDateTime()`.

    - #### 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 ignored.

    - #### 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 `LocalDate` type. When specified the `dateStyle` and `useIsoFormat` properties will be ignored.

      Parameters:
        `formatter` - the formatter to use
      Since:
        3.2
      See Also:
        `setTimeFormatter(DateTimeFormatter)`, `setDateTimeFormatter(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 `LocalTime` type. When specified the `timeStyle` and `useIsoFormat` properties will be ignored.

      Parameters:
        `formatter` - the formatter to use
      Since:
        3.2
      See Also:
        `setDateFormatter(DateTimeFormatter)`, `setDateTimeFormatter(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`, `Date` and `Calendar` types. When specified the `dateTimeStyle` and `useIsoFormat` properties will be ignored.

      Parameters:
        `formatter` - the formatter to use
      Since:
        3.2
      See Also:
        `setDateFormatter(DateTimeFormatter)`, `setTimeFormatter(DateTimeFormatter)`

    - #### 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 interface `FormatterRegistrar`
      Parameters:
        `registry` - the FormatterRegistry instance to use.