Class DefaultDataBinderFactory
java.lang.Object
org.springframework.web.bind.support.DefaultDataBinderFactory
- All Implemented Interfaces:
WebDataBinderFactory
- Direct Known Subclasses:
InitBinderDataBinderFactory
Create a
WebRequestDataBinder instance and initialize it with a
WebBindingInitializer.- Since:
- 3.1
- Author:
- Rossen Stoyanchev
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultDataBinderFactory(WebBindingInitializer initializer) Create a newDefaultDataBinderFactoryinstance. -
Method Summary
Modifier and TypeMethodDescriptionfinal WebDataBindercreateBinder(NativeWebRequest webRequest, Object target, String objectName) Create a newWebDataBinderfor the given target object and initialize it through aWebBindingInitializer.protected WebDataBindercreateBinderInstance(Object target, String objectName, NativeWebRequest webRequest) Extension point to create the WebDataBinder instance.protected voidinitBinder(WebDataBinder dataBinder, NativeWebRequest webRequest) Extension point to further initialize the created data binder instance (e.g.
-
Constructor Details
-
DefaultDataBinderFactory
Create a newDefaultDataBinderFactoryinstance.- Parameters:
initializer- for global data binder initialization (ornullif none)
-
-
Method Details
-
createBinder
public final WebDataBinder createBinder(NativeWebRequest webRequest, @Nullable Object target, String objectName) throws Exception Create a newWebDataBinderfor the given target object and initialize it through aWebBindingInitializer.- Specified by:
createBinderin interfaceWebDataBinderFactory- Parameters:
webRequest- the current requesttarget- the object to create a data binder for, ornullif creating a binder for a simple typeobjectName- the name of the target object- Returns:
- the created
WebDataBinderinstance, never null - Throws:
Exception- in case of invalid state or arguments
-
createBinderInstance
protected WebDataBinder createBinderInstance(@Nullable Object target, String objectName, NativeWebRequest webRequest) throws Exception Extension point to create the WebDataBinder instance. By default this isWebRequestDataBinder.- Parameters:
target- the binding target ornullfor type conversion onlyobjectName- the binding target object namewebRequest- the current request- Throws:
Exception- in case of invalid state or arguments
-
initBinder
Extension point to further initialize the created data binder instance (e.g. with@InitBindermethods) after "global" initialization viaWebBindingInitializer.- Parameters:
dataBinder- the data binder instance to customizewebRequest- the current request- Throws:
Exception- if initialization fails
-