ui.format system refining from RC1 feedback: Support for one format annotation applying to multiple field types, Printer/Parser building blocks for more flexibility, full Joda time formatting support, FormattingService as a service entry-point for clients to use

This commit is contained in:
Keith Donald
2009-10-30 18:44:40 +00:00
parent 471fbf7ebf
commit 913bc03a3b
56 changed files with 1731 additions and 1609 deletions

View File

@@ -17,7 +17,7 @@
package org.springframework.web.bind.support;
import org.springframework.beans.PropertyEditorRegistrar;
import org.springframework.ui.format.FormatterRegistry;
import org.springframework.ui.format.FormattingService;
import org.springframework.validation.BindingErrorProcessor;
import org.springframework.validation.MessageCodesResolver;
import org.springframework.validation.Validator;
@@ -46,7 +46,7 @@ public class ConfigurableWebBindingInitializer implements WebBindingInitializer
private Validator validator;
private FormatterRegistry formatterRegistry;
private FormattingService formattingService;
private PropertyEditorRegistrar[] propertyEditorRegistrars;
@@ -111,17 +111,17 @@ public class ConfigurableWebBindingInitializer implements WebBindingInitializer
}
/**
* Specify a FormatterRegistry which will apply to every DataBinder.
* Specify a FormattingService which will apply to every DataBinder.
*/
public final void setFormatterRegistry(FormatterRegistry formatterRegistry) {
this.formatterRegistry = formatterRegistry;
public final void setFormattingService(FormattingService formattingService) {
this.formattingService = formattingService;
}
/**
* Return a FormatterRegistry which will apply to every DataBinder.
* Return the FormattingService which will apply to every DataBinder.
*/
public final FormatterRegistry getFormatterRegistry() {
return this.formatterRegistry;
public final FormattingService getFormattingService() {
return this.formattingService;
}
/**
@@ -160,8 +160,8 @@ public class ConfigurableWebBindingInitializer implements WebBindingInitializer
this.validator.supports(binder.getTarget().getClass())) {
binder.setValidator(this.validator);
}
if (this.formatterRegistry != null) {
binder.setFormatterRegistry(this.formatterRegistry);
if (this.formattingService != null) {
binder.setFormattingService(this.formattingService);
}
if (this.propertyEditorRegistrars != null) {
for (PropertyEditorRegistrar propertyEditorRegistrar : this.propertyEditorRegistrars) {