Java Code Examples for org.springframework.format.FormatterRegistry#addFormatterForFieldAnnotation()
The following examples show how to use
org.springframework.format.FormatterRegistry#addFormatterForFieldAnnotation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultFormattingConversionService.java From java-technology-stack with MIT License | 6 votes |
/** * Add formatters appropriate for most environments: including number formatters, * JSR-354 Money & Currency formatters, JSR-310 Date-Time and/or Joda-Time formatters, * depending on the presence of the corresponding API on the classpath. * @param formatterRegistry the service to register default formatters with */ public static void addDefaultFormatters(FormatterRegistry formatterRegistry) { // Default handling of number values formatterRegistry.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory()); // Default handling of monetary values if (jsr354Present) { formatterRegistry.addFormatter(new CurrencyUnitFormatter()); formatterRegistry.addFormatter(new MonetaryAmountFormatter()); formatterRegistry.addFormatterForFieldAnnotation(new Jsr354NumberFormatAnnotationFormatterFactory()); } // Default handling of date-time values // just handling JSR-310 specific date and time types new DateTimeFormatterRegistrar().registerFormatters(formatterRegistry); if (jodaTimePresent) { // handles Joda-specific types as well as Date, Calendar, Long new JodaTimeFormatterRegistrar().registerFormatters(formatterRegistry); } else { // regular DateFormat-based Date, Calendar, Long converters new DateFormatterRegistrar().registerFormatters(formatterRegistry); } }
Example 2
Source File: DefaultFormattingConversionService.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Add formatters appropriate for most environments: including number formatters, * JSR-354 Money & Currency formatters, JSR-310 Date-Time and/or Joda-Time formatters, * depending on the presence of the corresponding API on the classpath. * @param formatterRegistry the service to register default formatters with */ public static void addDefaultFormatters(FormatterRegistry formatterRegistry) { // Default handling of number values formatterRegistry.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory()); // Default handling of monetary values if (jsr354Present) { formatterRegistry.addFormatter(new CurrencyUnitFormatter()); formatterRegistry.addFormatter(new MonetaryAmountFormatter()); formatterRegistry.addFormatterForFieldAnnotation(new Jsr354NumberFormatAnnotationFormatterFactory()); } // Default handling of date-time values if (jsr310Present) { // just handling JSR-310 specific date and time types new DateTimeFormatterRegistrar().registerFormatters(formatterRegistry); } if (jodaTimePresent) { // handles Joda-specific types as well as Date, Calendar, Long new JodaTimeFormatterRegistrar().registerFormatters(formatterRegistry); } else { // regular DateFormat-based Date, Calendar, Long converters new DateFormatterRegistrar().registerFormatters(formatterRegistry); } }
Example 3
Source File: DefaultFormattingConversionService.java From spring-analysis-note with MIT License | 6 votes |
/** * Add formatters appropriate for most environments: including number formatters, * JSR-354 Money & Currency formatters, JSR-310 Date-Time and/or Joda-Time formatters, * depending on the presence of the corresponding API on the classpath. * @param formatterRegistry the service to register default formatters with */ public static void addDefaultFormatters(FormatterRegistry formatterRegistry) { // Default handling of number values formatterRegistry.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory()); // Default handling of monetary values if (jsr354Present) { formatterRegistry.addFormatter(new CurrencyUnitFormatter()); formatterRegistry.addFormatter(new MonetaryAmountFormatter()); formatterRegistry.addFormatterForFieldAnnotation(new Jsr354NumberFormatAnnotationFormatterFactory()); } // Default handling of date-time values // just handling JSR-310 specific date and time types new DateTimeFormatterRegistrar().registerFormatters(formatterRegistry); if (jodaTimePresent) { // handles Joda-specific types as well as Date, Calendar, Long new JodaTimeFormatterRegistrar().registerFormatters(formatterRegistry); } else { // regular DateFormat-based Date, Calendar, Long converters new DateFormatterRegistrar().registerFormatters(formatterRegistry); } }
Example 4
Source File: DefaultFormattingConversionService.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Add formatters appropriate for most environments: including number formatters, * JSR-354 Money & Currency formatters, JSR-310 Date-Time and/or Joda-Time formatters, * depending on the presence of the corresponding API on the classpath. * @param formatterRegistry the service to register default formatters with */ public static void addDefaultFormatters(FormatterRegistry formatterRegistry) { // Default handling of number values formatterRegistry.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory()); // Default handling of monetary values if (jsr354Present) { formatterRegistry.addFormatter(new CurrencyUnitFormatter()); formatterRegistry.addFormatter(new MonetaryAmountFormatter()); formatterRegistry.addFormatterForFieldAnnotation(new Jsr354NumberFormatAnnotationFormatterFactory()); } // Default handling of date-time values if (jsr310Present) { // just handling JSR-310 specific date and time types new DateTimeFormatterRegistrar().registerFormatters(formatterRegistry); } if (jodaTimePresent) { // handles Joda-specific types as well as Date, Calendar, Long new JodaTimeFormatterRegistrar().registerFormatters(formatterRegistry); } else { // regular DateFormat-based Date, Calendar, Long converters new DateFormatterRegistrar().registerFormatters(formatterRegistry); } }
Example 5
Source File: DateFormatterRegistrar.java From spring-analysis-note with MIT License | 5 votes |
@Override public void registerFormatters(FormatterRegistry registry) { addDateConverters(registry); registry.addFormatterForFieldAnnotation(new DateTimeFormatAnnotationFormatterFactory()); // In order to retain back compatibility we only register Date/Calendar // types when a user defined formatter is specified (see SPR-10105) if (this.dateFormatter != null) { registry.addFormatter(this.dateFormatter); registry.addFormatterForFieldType(Calendar.class, this.dateFormatter); } }
Example 6
Source File: DispatcherServletConfiguration.java From find with MIT License | 5 votes |
@Override public void addFormatters(final FormatterRegistry registry) { if(converters != null) { for(final Converter<?, ?> converter : converters) { registry.addConverter(converter); } } registry.addFormatterForFieldAnnotation(new JodaDateTimeFormatAnnotationFormatterFactory()); }
Example 7
Source File: SpringletsEntityFormatWebConfiguration.java From springlets with Apache License 2.0 | 5 votes |
@Override public void addFormatters(FormatterRegistry registry) { super.addFormatters(registry); EntityFormatAnnotationFormatterFactory factory = new EntityFormatAnnotationFormatterFactory( messageSource, applicationContext, (FormattingConversionService) registry); registry.addFormatterForFieldAnnotation(factory); registry.addConverter(factory.getToStringConverter()); registry.addConverter(new EnumToMessageConverter(messageSource)); }
Example 8
Source File: DateFormatterRegistrar.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void registerFormatters(FormatterRegistry registry) { addDateConverters(registry); registry.addFormatterForFieldAnnotation(new DateTimeFormatAnnotationFormatterFactory()); // In order to retain back compatibility we only register Date/Calendar // types when a user defined formatter is specified (see SPR-10105) if (this.dateFormatter != null) { registry.addFormatter(this.dateFormatter); registry.addFormatterForFieldType(Calendar.class, this.dateFormatter); } }
Example 9
Source File: DateTimeFormatterRegistrar.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void registerFormatters(FormatterRegistry registry) { DateTimeConverters.registerConverters(registry); DateTimeFormatter dateFormatter = getFormatter(Type.DATE); DateTimeFormatter timeFormatter = getFormatter(Type.TIME); DateTimeFormatter dateTimeFormatter = getFormatter(Type.DATE_TIME); registry.addFormatterForFieldType(LocalDate.class, new TemporalAccessorPrinter(dateFormatter), new TemporalAccessorParser(LocalDate.class, dateFormatter)); registry.addFormatterForFieldType(LocalTime.class, new TemporalAccessorPrinter(timeFormatter), new TemporalAccessorParser(LocalTime.class, timeFormatter)); registry.addFormatterForFieldType(LocalDateTime.class, new TemporalAccessorPrinter(dateTimeFormatter), new TemporalAccessorParser(LocalDateTime.class, dateTimeFormatter)); registry.addFormatterForFieldType(ZonedDateTime.class, new TemporalAccessorPrinter(dateTimeFormatter), new TemporalAccessorParser(ZonedDateTime.class, dateTimeFormatter)); registry.addFormatterForFieldType(OffsetDateTime.class, new TemporalAccessorPrinter(dateTimeFormatter), new TemporalAccessorParser(OffsetDateTime.class, dateTimeFormatter)); registry.addFormatterForFieldType(OffsetTime.class, new TemporalAccessorPrinter(timeFormatter), new TemporalAccessorParser(OffsetTime.class, timeFormatter)); registry.addFormatterForFieldType(Instant.class, new InstantFormatter()); registry.addFormatterForFieldType(Period.class, new PeriodFormatter()); registry.addFormatterForFieldType(Duration.class, new DurationFormatter()); registry.addFormatterForFieldType(YearMonth.class, new YearMonthFormatter()); registry.addFormatterForFieldType(MonthDay.class, new MonthDayFormatter()); registry.addFormatterForFieldAnnotation(new Jsr310DateTimeFormatAnnotationFormatterFactory()); }
Example 10
Source File: DateFormatterRegistrar.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void registerFormatters(FormatterRegistry registry) { addDateConverters(registry); registry.addFormatterForFieldAnnotation(new DateTimeFormatAnnotationFormatterFactory()); // In order to retain back compatibility we only register Date/Calendar // types when a user defined formatter is specified (see SPR-10105) if (this.dateFormatter != null) { registry.addFormatter(this.dateFormatter); registry.addFormatterForFieldType(Calendar.class, this.dateFormatter); } }
Example 11
Source File: DateTimeFormatterRegistrar.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void registerFormatters(FormatterRegistry registry) { DateTimeConverters.registerConverters(registry); DateTimeFormatter df = getFormatter(Type.DATE); DateTimeFormatter tf = getFormatter(Type.TIME); DateTimeFormatter dtf = getFormatter(Type.DATE_TIME); // Efficient ISO_LOCAL_* variants for printing since they are twice as fast... registry.addFormatterForFieldType(LocalDate.class, new TemporalAccessorPrinter( df == DateTimeFormatter.ISO_DATE ? DateTimeFormatter.ISO_LOCAL_DATE : df), new TemporalAccessorParser(LocalDate.class, df)); registry.addFormatterForFieldType(LocalTime.class, new TemporalAccessorPrinter( tf == DateTimeFormatter.ISO_TIME ? DateTimeFormatter.ISO_LOCAL_TIME : tf), new TemporalAccessorParser(LocalTime.class, tf)); registry.addFormatterForFieldType(LocalDateTime.class, new TemporalAccessorPrinter( dtf == DateTimeFormatter.ISO_DATE_TIME ? DateTimeFormatter.ISO_LOCAL_DATE_TIME : dtf), new TemporalAccessorParser(LocalDateTime.class, dtf)); registry.addFormatterForFieldType(ZonedDateTime.class, new TemporalAccessorPrinter(dtf), new TemporalAccessorParser(ZonedDateTime.class, dtf)); registry.addFormatterForFieldType(OffsetDateTime.class, new TemporalAccessorPrinter(dtf), new TemporalAccessorParser(OffsetDateTime.class, dtf)); registry.addFormatterForFieldType(OffsetTime.class, new TemporalAccessorPrinter(tf), new TemporalAccessorParser(OffsetTime.class, tf)); registry.addFormatterForFieldType(Instant.class, new InstantFormatter()); registry.addFormatterForFieldType(Period.class, new PeriodFormatter()); registry.addFormatterForFieldType(Duration.class, new DurationFormatter()); registry.addFormatterForFieldType(YearMonth.class, new YearMonthFormatter()); registry.addFormatterForFieldType(MonthDay.class, new MonthDayFormatter()); registry.addFormatterForFieldAnnotation(new Jsr310DateTimeFormatAnnotationFormatterFactory()); }
Example 12
Source File: WallRideWebMvcConfiguration.java From wallride with Apache License 2.0 | 4 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addFormatterForFieldAnnotation(new CodeFormatAnnotationFormatterFactory()); }
Example 13
Source File: WebAdminConfiguration.java From wallride with Apache License 2.0 | 4 votes |
@Override public void addFormatters(FormatterRegistry registry) { super.addFormatters(registry); registry.addFormatterForFieldAnnotation(new CodeFormatAnnotationFormatterFactory()); }
Example 14
Source File: JodaTimeFormatterRegistrar.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public void registerFormatters(FormatterRegistry registry) { JodaTimeConverters.registerConverters(registry); DateTimeFormatter dateFormatter = getFormatter(Type.DATE); DateTimeFormatter timeFormatter = getFormatter(Type.TIME); DateTimeFormatter dateTimeFormatter = getFormatter(Type.DATE_TIME); addFormatterForFields(registry, new ReadablePartialPrinter(dateFormatter), new LocalDateParser(dateFormatter), LocalDate.class); addFormatterForFields(registry, new ReadablePartialPrinter(timeFormatter), new LocalTimeParser(timeFormatter), LocalTime.class); addFormatterForFields(registry, new ReadablePartialPrinter(dateTimeFormatter), new LocalDateTimeParser(dateTimeFormatter), LocalDateTime.class); addFormatterForFields(registry, new ReadableInstantPrinter(dateTimeFormatter), new DateTimeParser(dateTimeFormatter), ReadableInstant.class); // In order to retain backwards compatibility we only register Date/Calendar // types when a user defined formatter is specified (see SPR-10105) if (this.formatters.containsKey(Type.DATE_TIME)) { addFormatterForFields(registry, new ReadableInstantPrinter(dateTimeFormatter), new DateTimeParser(dateTimeFormatter), Date.class, Calendar.class); } registry.addFormatterForFieldType(Period.class, new PeriodFormatter()); registry.addFormatterForFieldType(Duration.class, new DurationFormatter()); if (jodaTime2Available) { JodaTime2Delegate.registerAdditionalFormatters(registry); } registry.addFormatterForFieldAnnotation(new JodaDateTimeFormatAnnotationFormatterFactory()); }
Example 15
Source File: JodaTimeFormatterRegistrar.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void registerFormatters(FormatterRegistry registry) { JodaTimeConverters.registerConverters(registry); DateTimeFormatter dateFormatter = getFormatter(Type.DATE); DateTimeFormatter timeFormatter = getFormatter(Type.TIME); DateTimeFormatter dateTimeFormatter = getFormatter(Type.DATE_TIME); addFormatterForFields(registry, new ReadablePartialPrinter(dateFormatter), new LocalDateParser(dateFormatter), LocalDate.class); addFormatterForFields(registry, new ReadablePartialPrinter(timeFormatter), new LocalTimeParser(timeFormatter), LocalTime.class); addFormatterForFields(registry, new ReadablePartialPrinter(dateTimeFormatter), new LocalDateTimeParser(dateTimeFormatter), LocalDateTime.class); addFormatterForFields(registry, new ReadableInstantPrinter(dateTimeFormatter), new DateTimeParser(dateTimeFormatter), ReadableInstant.class); // In order to retain backwards compatibility we only register Date/Calendar // types when a user defined formatter is specified (see SPR-10105) if (this.formatters.containsKey(Type.DATE_TIME)) { addFormatterForFields(registry, new ReadableInstantPrinter(dateTimeFormatter), new DateTimeParser(dateTimeFormatter), Date.class, Calendar.class); } registry.addFormatterForFieldType(Period.class, new PeriodFormatter()); registry.addFormatterForFieldType(Duration.class, new DurationFormatter()); if (jodaTime2Available) { JodaTime2Delegate.registerAdditionalFormatters(registry); } registry.addFormatterForFieldAnnotation(new JodaDateTimeFormatAnnotationFormatterFactory()); }
Example 16
Source File: WebMvcConfig.java From bearchoke with Apache License 2.0 | 4 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addFormatterForFieldAnnotation(new Jsr310DateTimeFormatAnnotationFormatterFactory()); }
Example 17
Source File: DateTimeFormatterRegistrar.java From java-technology-stack with MIT License | 4 votes |
@Override public void registerFormatters(FormatterRegistry registry) { DateTimeConverters.registerConverters(registry); DateTimeFormatter df = getFormatter(Type.DATE); DateTimeFormatter tf = getFormatter(Type.TIME); DateTimeFormatter dtf = getFormatter(Type.DATE_TIME); // Efficient ISO_LOCAL_* variants for printing since they are twice as fast... registry.addFormatterForFieldType(LocalDate.class, new TemporalAccessorPrinter( df == DateTimeFormatter.ISO_DATE ? DateTimeFormatter.ISO_LOCAL_DATE : df), new TemporalAccessorParser(LocalDate.class, df)); registry.addFormatterForFieldType(LocalTime.class, new TemporalAccessorPrinter( tf == DateTimeFormatter.ISO_TIME ? DateTimeFormatter.ISO_LOCAL_TIME : tf), new TemporalAccessorParser(LocalTime.class, tf)); registry.addFormatterForFieldType(LocalDateTime.class, new TemporalAccessorPrinter( dtf == DateTimeFormatter.ISO_DATE_TIME ? DateTimeFormatter.ISO_LOCAL_DATE_TIME : dtf), new TemporalAccessorParser(LocalDateTime.class, dtf)); registry.addFormatterForFieldType(ZonedDateTime.class, new TemporalAccessorPrinter(dtf), new TemporalAccessorParser(ZonedDateTime.class, dtf)); registry.addFormatterForFieldType(OffsetDateTime.class, new TemporalAccessorPrinter(dtf), new TemporalAccessorParser(OffsetDateTime.class, dtf)); registry.addFormatterForFieldType(OffsetTime.class, new TemporalAccessorPrinter(tf), new TemporalAccessorParser(OffsetTime.class, tf)); registry.addFormatterForFieldType(Instant.class, new InstantFormatter()); registry.addFormatterForFieldType(Period.class, new PeriodFormatter()); registry.addFormatterForFieldType(Duration.class, new DurationFormatter()); registry.addFormatterForFieldType(Year.class, new YearFormatter()); registry.addFormatterForFieldType(Month.class, new MonthFormatter()); registry.addFormatterForFieldType(YearMonth.class, new YearMonthFormatter()); registry.addFormatterForFieldType(MonthDay.class, new MonthDayFormatter()); registry.addFormatterForFieldAnnotation(new Jsr310DateTimeFormatAnnotationFormatterFactory()); }
Example 18
Source File: JodaTimeFormatterRegistrar.java From java-technology-stack with MIT License | 4 votes |
@Override public void registerFormatters(FormatterRegistry registry) { JodaTimeConverters.registerConverters(registry); DateTimeFormatter dateFormatter = getFormatter(Type.DATE); DateTimeFormatter timeFormatter = getFormatter(Type.TIME); DateTimeFormatter dateTimeFormatter = getFormatter(Type.DATE_TIME); addFormatterForFields(registry, new ReadablePartialPrinter(dateFormatter), new LocalDateParser(dateFormatter), LocalDate.class); addFormatterForFields(registry, new ReadablePartialPrinter(timeFormatter), new LocalTimeParser(timeFormatter), LocalTime.class); addFormatterForFields(registry, new ReadablePartialPrinter(dateTimeFormatter), new LocalDateTimeParser(dateTimeFormatter), LocalDateTime.class); addFormatterForFields(registry, new ReadableInstantPrinter(dateTimeFormatter), new DateTimeParser(dateTimeFormatter), ReadableInstant.class); // In order to retain backwards compatibility we only register Date/Calendar // types when a user defined formatter is specified (see SPR-10105) if (this.formatters.containsKey(Type.DATE_TIME)) { addFormatterForFields(registry, new ReadableInstantPrinter(dateTimeFormatter), new DateTimeParser(dateTimeFormatter), Date.class, Calendar.class); } registry.addFormatterForFieldType(Period.class, new PeriodFormatter()); registry.addFormatterForFieldType(Duration.class, new DurationFormatter()); registry.addFormatterForFieldType(YearMonth.class, new YearMonthFormatter()); registry.addFormatterForFieldType(MonthDay.class, new MonthDayFormatter()); registry.addFormatterForFieldAnnotation(new JodaDateTimeFormatAnnotationFormatterFactory()); }
Example 19
Source File: DateTimeFormatterRegistrar.java From spring-analysis-note with MIT License | 4 votes |
@Override public void registerFormatters(FormatterRegistry registry) { DateTimeConverters.registerConverters(registry); DateTimeFormatter df = getFormatter(Type.DATE); DateTimeFormatter tf = getFormatter(Type.TIME); DateTimeFormatter dtf = getFormatter(Type.DATE_TIME); // Efficient ISO_LOCAL_* variants for printing since they are twice as fast... registry.addFormatterForFieldType(LocalDate.class, new TemporalAccessorPrinter( df == DateTimeFormatter.ISO_DATE ? DateTimeFormatter.ISO_LOCAL_DATE : df), new TemporalAccessorParser(LocalDate.class, df)); registry.addFormatterForFieldType(LocalTime.class, new TemporalAccessorPrinter( tf == DateTimeFormatter.ISO_TIME ? DateTimeFormatter.ISO_LOCAL_TIME : tf), new TemporalAccessorParser(LocalTime.class, tf)); registry.addFormatterForFieldType(LocalDateTime.class, new TemporalAccessorPrinter( dtf == DateTimeFormatter.ISO_DATE_TIME ? DateTimeFormatter.ISO_LOCAL_DATE_TIME : dtf), new TemporalAccessorParser(LocalDateTime.class, dtf)); registry.addFormatterForFieldType(ZonedDateTime.class, new TemporalAccessorPrinter(dtf), new TemporalAccessorParser(ZonedDateTime.class, dtf)); registry.addFormatterForFieldType(OffsetDateTime.class, new TemporalAccessorPrinter(dtf), new TemporalAccessorParser(OffsetDateTime.class, dtf)); registry.addFormatterForFieldType(OffsetTime.class, new TemporalAccessorPrinter(tf), new TemporalAccessorParser(OffsetTime.class, tf)); registry.addFormatterForFieldType(Instant.class, new InstantFormatter()); registry.addFormatterForFieldType(Period.class, new PeriodFormatter()); registry.addFormatterForFieldType(Duration.class, new DurationFormatter()); registry.addFormatterForFieldType(Year.class, new YearFormatter()); registry.addFormatterForFieldType(Month.class, new MonthFormatter()); registry.addFormatterForFieldType(YearMonth.class, new YearMonthFormatter()); registry.addFormatterForFieldType(MonthDay.class, new MonthDayFormatter()); registry.addFormatterForFieldAnnotation(new Jsr310DateTimeFormatAnnotationFormatterFactory()); }
Example 20
Source File: JodaTimeFormatterRegistrar.java From spring-analysis-note with MIT License | 4 votes |
@Override public void registerFormatters(FormatterRegistry registry) { JodaTimeConverters.registerConverters(registry); DateTimeFormatter dateFormatter = getFormatter(Type.DATE); DateTimeFormatter timeFormatter = getFormatter(Type.TIME); DateTimeFormatter dateTimeFormatter = getFormatter(Type.DATE_TIME); addFormatterForFields(registry, new ReadablePartialPrinter(dateFormatter), new LocalDateParser(dateFormatter), LocalDate.class); addFormatterForFields(registry, new ReadablePartialPrinter(timeFormatter), new LocalTimeParser(timeFormatter), LocalTime.class); addFormatterForFields(registry, new ReadablePartialPrinter(dateTimeFormatter), new LocalDateTimeParser(dateTimeFormatter), LocalDateTime.class); addFormatterForFields(registry, new ReadableInstantPrinter(dateTimeFormatter), new DateTimeParser(dateTimeFormatter), ReadableInstant.class); // In order to retain backwards compatibility we only register Date/Calendar // types when a user defined formatter is specified (see SPR-10105) if (this.formatters.containsKey(Type.DATE_TIME)) { addFormatterForFields(registry, new ReadableInstantPrinter(dateTimeFormatter), new DateTimeParser(dateTimeFormatter), Date.class, Calendar.class); } registry.addFormatterForFieldType(Period.class, new PeriodFormatter()); registry.addFormatterForFieldType(Duration.class, new DurationFormatter()); registry.addFormatterForFieldType(YearMonth.class, new YearMonthFormatter()); registry.addFormatterForFieldType(MonthDay.class, new MonthDayFormatter()); registry.addFormatterForFieldAnnotation(new JodaDateTimeFormatAnnotationFormatterFactory()); }