class ModelFactory
Assist with initialization of the Model before controller method invocation and with updates to it after the invocation.
On initialization the model is populated with attributes temporarily stored in the session and through the invocation of @ModelAttribute methods.
On update model attributes are synchronized with the session and also BindingResult attributes are added if missing.
Author
Rossen Stoyanchev
Since
3.1
ModelFactory(handlerMethods: MutableList<InvocableHandlerMethod>, binderFactory: WebDataBinderFactory, attributeHandler: SessionAttributesHandler)
Create a new instance with the given |
static fun getNameForParameter(parameter: MethodParameter): String
Derive the model attribute name for the given method parameter based on a |
|
static fun getNameForReturnValue(returnValue: Any, returnType: MethodParameter): String
Derive the model attribute name for the given return value based on:
|
|
fun initModel(request: NativeWebRequest, container: ModelAndViewContainer, handlerMethod: HandlerMethod): Unit
Populate the model in the following order:
|
|
fun updateModel(request: NativeWebRequest, container: ModelAndViewContainer): Unit
Promote model attributes listed as |