open class ModelAttributeMethodProcessor : HandlerMethodArgumentResolver, HandlerMethodReturnValueHandler
Resolve @ModelAttribute annotated method arguments and handle return values from @ModelAttribute annotated methods.
Model attributes are obtained from the model or created with a default constructor (and then added to the model). Once created the attribute is populated via data binding to Servlet request parameters. Validation may be applied if the argument is annotated with @javax.validation.Valid. or Spring's own @org.springframework.validation.annotation.Validated.
When this handler is created with annotationNotRequired=true any non-simple type argument and return value is regarded as a model attribute with or without the presence of an @ModelAttribute.
Author
Rossen Stoyanchev
Author
Juergen Hoeller
Author
Sebastien Deleuze
Since
3.1
ModelAttributeMethodProcessor(annotationNotRequired: Boolean)
Class constructor. |
open fun handleReturnValue(returnValue: Any, returnType: MethodParameter, mavContainer: ModelAndViewContainer, webRequest: NativeWebRequest): Unit
Add non-null return values to the ModelAndViewContainer. |
|
fun resolveArgument(parameter: MethodParameter, mavContainer: ModelAndViewContainer, webRequest: NativeWebRequest, binderFactory: WebDataBinderFactory): Any
Resolve the argument from the model or if not found instantiate it with its default if it is available. The model attribute is then populated with request values via data binding and optionally validated if |
|
open fun supportsParameter(parameter: MethodParameter): Boolean
Returns |
|
open fun supportsReturnType(returnType: MethodParameter): Boolean
Return |
open class ServletModelAttributeMethodProcessor : ModelAttributeMethodProcessor
A Servlet-specific ModelAttributeMethodProcessor that applies data binding through a WebDataBinder of type ServletRequestDataBinder. Also adds a fall-back strategy to instantiate the model attribute from a URI template variable or from a request parameter if the name matches the model attribute name and there is an appropriate type conversion strategy. |