org.springframework.web.method.annotation
Class InitBinderDataBinderFactory
java.lang.Object
org.springframework.web.bind.support.DefaultDataBinderFactory
org.springframework.web.method.annotation.InitBinderDataBinderFactory
- All Implemented Interfaces:
- WebDataBinderFactory
- Direct Known Subclasses:
- ServletRequestDataBinderFactory
public class InitBinderDataBinderFactory
- extends DefaultDataBinderFactory
Adds initialization to a WebDataBinder via @InitBinder
methods.
- Since:
- 3.1
- Author:
- Rossen Stoyanchev
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
binderMethods
private final java.util.List<InvocableHandlerMethod> binderMethods
InitBinderDataBinderFactory
public InitBinderDataBinderFactory(java.util.List<InvocableHandlerMethod> binderMethods,
WebBindingInitializer initializer)
- Create a new instance.
- Parameters:
binderMethods
- @InitBinder
methods, or null
initializer
- for global data binder intialization
initBinder
public void initBinder(WebDataBinder binder,
NativeWebRequest request)
throws java.lang.Exception
- 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.
- Overrides:
initBinder
in class DefaultDataBinderFactory
- Parameters:
binder
- the data binder instance to customizerequest
- the current request
- Throws:
java.lang.Exception
- if one of the invoked @InitBinder
methods fail.
isBinderMethodApplicable
protected boolean isBinderMethodApplicable(HandlerMethod initBinderMethod,
WebDataBinder binder)
- Return
true
if the given @InitBinder
method should be
invoked to initialize the given WebDataBinder.
The default implementation checks if target object name is included
in the attribute names specified in the @InitBinder
annotation.