Top Description Fields Constructors Methods
org.springframework.web.method.annotation

public Class InitBinderDataBinderFactory

extends DefaultDataBinderFactory
Class Inheritance
Imports
java.util.Collections, .List, org.springframework.lang.Nullable, org.springframework.util.Assert, .ObjectUtils, org.springframework.web.bind.WebDataBinder, org.springframework.web.bind.annotation.InitBinder, org.springframework.web.bind.support.DefaultDataBinderFactory, .WebBindingInitializer, org.springframework.web.context.request.NativeWebRequest, org.springframework.web.method.HandlerMethod, org.springframework.web.method.support.InvocableHandlerMethod

Adds initialization to a WebDataBinder via @InitBinder methods.
Author
Rossen Stoyanchev
Since
3.1

Field Summary

Modifier and TypeField and Description
private final List<InvocableHandlerMethod>

Constructor Summary

AccessConstructor and Description
public
InitBinderDataBinderFactory(List<InvocableHandlerMethod>
@InitBinder methods
binderMethods
,
WebBindingInitializer
for global data binder initialization
initializer
)

Create a new InitBinderDataBinderFactory instance.

Method Summary

Modifier and TypeMethod and Description
public void
initBinder(WebDataBinder
the data binder instance to customize
dataBinder
,
NativeWebRequest
the current request
request
)

Overrides org.springframework.web.bind.support.DefaultDataBinderFactory.initBinder.

Initialize a WebDataBinder with @InitBinder methods.

protected boolean
isBinderMethodApplicable(HandlerMethod initBinderMethod, WebDataBinder dataBinder)

Determine whether the given @InitBinder method should be used to initialize the given WebDataBinder instance.

Inherited from org.springframework.web.bind.support.DefaultDataBinderFactory:
createBindercreateBindercreateBinderInstancesetMethodValidationApplicable

Field Detail

binderMethodsback to summary
private final List<InvocableHandlerMethod> binderMethods

Constructor Detail

InitBinderDataBinderFactoryback to summary
public InitBinderDataBinderFactory(List<InvocableHandlerMethod> binderMethods, WebBindingInitializer initializer)

Create a new InitBinderDataBinderFactory instance.

Parameters
binderMethods:List<InvocableHandlerMethod>

@InitBinder methods

initializer:WebBindingInitializer

for global data binder initialization

Method Detail

initBinderback to summary
public void initBinder(WebDataBinder dataBinder, NativeWebRequest request) throws Exception

Overrides org.springframework.web.bind.support.DefaultDataBinderFactory.initBinder.

Initialize a WebDataBinder with @InitBinder methods.

If the @InitBinder annotation specifies attributes names, it is invoked only if the names include the target object name.

Parameters
dataBinder:WebDataBinder

Doc from org.springframework.web.bind.support.DefaultDataBinderFactory.initBinder.

the data binder instance to customize

request:NativeWebRequest

Doc from org.springframework.web.bind.support.DefaultDataBinderFactory.initBinder.

the current request

Annotations
@Override
Exceptions
Exception:
if one of the invoked @InitBinder methods fails
See Also
isBinderMethodApplicable
isBinderMethodApplicableback to summary
protected boolean isBinderMethodApplicable(HandlerMethod initBinderMethod, WebDataBinder dataBinder)

Determine whether the given @InitBinder method should be used to initialize the given WebDataBinder instance. By default we check the specified attribute names in the annotation value, if any.