Top Description Inners Fields Constructors Methods
org.springframework.web.bind.support

public Class DefaultDataBinderFactory

extends Object
implements WebDataBinderFactory
Class Inheritance
All Implemented Interfaces
org.springframework.web.bind.support.WebDataBinderFactory
Known Direct Subclasses
org.springframework.web.method.annotation.InitBinderDataBinderFactory
Imports
java.lang.annotation.Annotation, org.springframework.core.MethodParameter, .ResolvableType, org.springframework.lang.Nullable, org.springframework.validation.DataBinder, .SmartValidator, org.springframework.web.bind.WebDataBinder, org.springframework.web.context.request.NativeWebRequest

Create a WebRequestDataBinder instance and initialize it with a WebBindingInitializer.
Author
Rossen Stoyanchev
Since
3.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
DefaultDataBinderFactory.MethodValidationInitializer

Excludes Bean Validation if the method parameter has @Valid.

Field Summary

Modifier and TypeField and Description
private final WebBindingInitializer
private boolean

Constructor Summary

AccessConstructor and Description
public
DefaultDataBinderFactory(WebBindingInitializer
for global data binder initialization (or null if none)
initializer
)

Create a new DefaultDataBinderFactory instance.

Method Summary

Modifier and TypeMethod and Description
public final WebDataBinder
createBinder(NativeWebRequest
the current request
webRequest
,
Object
the object to create a data binder for, or null if creating a binder for a simple type
target
,
String
the name of the target object
objectName
)

Implements org.springframework.web.bind.support.WebDataBinderFactory.createBinder.

Create a new WebDataBinder for the given target object and initialize it through a WebBindingInitializer.

public final WebDataBinder
protected WebDataBinder
createBinderInstance(Object
the binding target or null for type conversion only
target
,
String
the binding target object name
objectName
,
NativeWebRequest
the current request
webRequest
)

Extension point to create the WebDataBinder instance.

private WebDataBinder
createBinderInternal(NativeWebRequest webRequest, Object target, String objectName, ResolvableType type)

protected void
initBinder(WebDataBinder
the data binder instance to customize
dataBinder
,
NativeWebRequest
the current request
webRequest
)

Extension point to further initialize the created data binder instance (e.g. with @InitBinder methods) after "global" initialization via WebBindingInitializer.

public void
setMethodValidationApplicable(boolean methodValidationApplicable)

Configure flag to signal whether validation will be applied to handler method arguments, which is the case if Bean Validation is enabled in Spring MVC, and method parameters have @Constraint annotations.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

initializerback to summary
private final WebBindingInitializer initializer
Annotations
@Nullable
methodValidationApplicableback to summary
private boolean methodValidationApplicable

Constructor Detail

DefaultDataBinderFactoryback to summary
public DefaultDataBinderFactory(WebBindingInitializer initializer)

Create a new DefaultDataBinderFactory instance.

Parameters
initializer:WebBindingInitializer

for global data binder initialization (or null if none)

Method Detail

createBinderback to summary
public final WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName) throws Exception

Implements org.springframework.web.bind.support.WebDataBinderFactory.createBinder.

Create a new WebDataBinder for the given target object and initialize it through a WebBindingInitializer.

Parameters
webRequest:NativeWebRequest

Doc from org.springframework.web.bind.support.WebDataBinderFactory.createBinder.

the current request

target:Object

Doc from org.springframework.web.bind.support.WebDataBinderFactory.createBinder.

the object to create a data binder for, or null if creating a binder for a simple type

objectName:String

Doc from org.springframework.web.bind.support.WebDataBinderFactory.createBinder.

the name of the target object

Returns:WebDataBinder

Doc from org.springframework.web.bind.support.WebDataBinderFactory.createBinder.

the created WebDataBinder instance, never null

Annotations
@Override
Exceptions
Exception:
in case of invalid state or arguments
createBinderback to summary
public final WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName, ResolvableType type) throws Exception

Overrides default org.springframework.web.bind.support.WebDataBinderFactory.createBinder.

Doc from org.springframework.web.bind.support.WebDataBinderFactory.createBinder.

Variant of createBinder(NativeWebRequest, Object, String) with a ResolvableType for which the DataBinder is created. This may be used to construct the target, or otherwise provide more insight on how to initialize the binder..

By default, if the parameter has @Valid, Bean Validation is excluded, deferring to method validation.

Annotations
@Override
createBinderInstanceback to summary
protected WebDataBinder createBinderInstance(Object target, String objectName, NativeWebRequest webRequest) throws Exception

Extension point to create the WebDataBinder instance. By default, this is WebRequestDataBinder.

Parameters
target:Object

the binding target or null for type conversion only

objectName:String

the binding target object name

webRequest:NativeWebRequest

the current request

Exceptions
Exception:
in case of invalid state or arguments
createBinderInternalback to summary
private WebDataBinder createBinderInternal(NativeWebRequest webRequest, Object target, String objectName, ResolvableType type) throws Exception
initBinderback to summary
protected void initBinder(WebDataBinder dataBinder, NativeWebRequest webRequest) throws Exception

Extension point to further initialize the created data binder instance (e.g. with @InitBinder methods) after "global" initialization via WebBindingInitializer.

Parameters
dataBinder:WebDataBinder

the data binder instance to customize

webRequest:NativeWebRequest

the current request

Exceptions
Exception:
if initialization fails
setMethodValidationApplicableback to summary
public void setMethodValidationApplicable(boolean methodValidationApplicable)

Configure flag to signal whether validation will be applied to handler method arguments, which is the case if Bean Validation is enabled in Spring MVC, and method parameters have @Constraint annotations.

Since
6.1
org.springframework.web.bind.support back to summary

private Class DefaultDataBinderFactory.MethodValidationInitializer

extends Object
Class Inheritance
  • java.lang.Object
  • org.springframework.web.bind.support.DefaultDataBinderFactory.MethodValidationInitializer

Excludes Bean Validation if the method parameter has @Valid.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MethodValidationInitializerback to summary
private MethodValidationInitializer()

Method Detail

initBinderback to summary
public static void initBinder(DataBinder binder, MethodParameter parameter)