Subclasses define how to do the following:
A default value string can contain ${...} placeholders and Spring Expression
Language #{...} expressions. For this to work a
ConfigurableBeanFactory must be supplied to the class constructor.
A WebDataBinder is created to apply type conversion to the resolved
argument value if it doesn't match the method parameter type.
| Modifier and Type | Class and Description |
|---|---|
| private static class | AbstractNamedValueMethodArgumentResolver.KotlinDelegate
Inner class to avoid a hard dependency on Kotlin at runtime. |
| protected static class | AbstractNamedValueMethodArgumentResolver.NamedValueInfo
Represents the information about a named value, including name, whether it's required and a default value. |
| Modifier and Type | Field and Description |
|---|---|
| private final ConfigurableBeanFactory | |
| private final BeanExpressionContext | |
| private final Map |
| Access | Constructor and Description |
|---|---|
| public | |
| public | AbstractNamedValueMethodArgumentResolver(ConfigurableBeanFactory
a bean factory to use for resolving ${...} placeholder
and #{...} SpEL expressions in default values, or beanFactory)null if default
values are not expected to contain expressionsCreate a new |
| Modifier and Type | Method and Description |
|---|---|
| private static Object | convertIfNecessary(MethodParameter parameter, NativeWebRequest webRequest, WebDataBinderFactory binderFactory, AbstractNamedValueMethodArgumentResolver.
|
| protected abstract AbstractNamedValueMethodArgumentResolver. | Returns: the named value informationthe method parameter parameter)Create the |
| private AbstractNamedValueMethodArgumentResolver. | |
| protected void | handleMissingValue(String
the name for the value name, MethodParameter the method parameter parameter, NativeWebRequest the current request request)Invoked when a named value is required, but |
| protected void | handleMissingValue(String
the name for the value name, MethodParameter the method parameter parameter)Invoked when a named value is required, but |
| protected void | handleMissingValueAfterConversion(String
the name for the value name, MethodParameter the method parameter parameter, NativeWebRequest the current request request)Invoked when a named value is present but becomes |
| private Object | handleNullValue(String name, Object value, Class<?> paramType)
A |
| protected void | handleResolvedValue(Object
the resolved argument value arg, String the argument name name, MethodParameter the argument parameter type parameter, ModelAndViewContainer the mavContainer, NativeWebRequest ModelAndViewContainer (may be null)the current request webRequest)Invoked after a value is resolved. |
| public final Object | resolveArgument(MethodParameter
the method parameter to resolve. This parameter must
have previously been passed to parameter, ModelAndViewContainer supportsParameter which must
have returned true.the ModelAndViewContainer for the current request mavContainer, NativeWebRequest the current request webRequest, WebDataBinderFactory a factory for creating binderFactory)WebDataBinder instancesImplements org. |
| private Object | resolveEmbeddedValuesAndExpressions(String value)
Resolve the given annotation-specified value, potentially containing placeholders and expressions. |
| protected abstract Object | Returns: the resolved argument (may benull)the name of the value being resolved name, MethodParameter the method parameter to resolve to an argument value
(pre-nested in case of a parameter, NativeWebRequest java. declaration)the current request request)Resolve the given parameter type and value name into an argument value. |
| private AbstractNamedValueMethodArgumentResolver. | updateNamedValueInfo(MethodParameter parameter, AbstractNamedValueMethodArgumentResolver.
Create a new NamedValueInfo based on the given NamedValueInfo with sanitized values. |
| configurableBeanFactory | back to summary |
|---|---|
| private final ConfigurableBeanFactory configurableBeanFactory
| |
| expressionContext | back to summary |
|---|---|
| private final BeanExpressionContext expressionContext
| |
| namedValueInfoCache | back to summary |
|---|---|
| private final Map<MethodParameter, AbstractNamedValueMethodArgumentResolver. | |
| AbstractNamedValueMethodArgumentResolver | back to summary |
|---|---|
| public AbstractNamedValueMethodArgumentResolver() | |
| AbstractNamedValueMethodArgumentResolver | back to summary |
|---|---|
| public AbstractNamedValueMethodArgumentResolver(ConfigurableBeanFactory beanFactory) Create a new
| |
| convertIfNecessary | back to summary |
|---|---|
private static Object convertIfNecessary(MethodParameter parameter, NativeWebRequest webRequest, WebDataBinderFactory binderFactory, AbstractNamedValueMethodArgumentResolver.
| |
| createNamedValueInfo | back to summary |
|---|---|
| protected abstract AbstractNamedValueMethodArgumentResolver. Create the
| |
| getNamedValueInfo | back to summary |
|---|---|
| private AbstractNamedValueMethodArgumentResolver. Obtain the named value for the given method parameter. | |
| handleMissingValue | back to summary |
|---|---|
| protected void handleMissingValue(String name, MethodParameter parameter, NativeWebRequest request) throws Exception Invoked when a named value is required, but
| |
| handleMissingValue | back to summary |
|---|---|
| protected void handleMissingValue(String name, MethodParameter parameter) throws ServletException Invoked when a named value is required, but
| |
| handleMissingValueAfterConversion | back to summary |
|---|---|
| protected void handleMissingValueAfterConversion(String name, MethodParameter parameter, NativeWebRequest request) throws Exception Invoked when a named value is present but becomes
| |
| handleNullValue | back to summary |
|---|---|
| private Object handleNullValue(String name, Object value, Class<?> paramType) A
| |
| handleResolvedValue | back to summary |
|---|---|
| protected void handleResolvedValue(Object arg, String name, MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest) Invoked after a value is resolved.
| |
| resolveArgument | back to summary |
|---|---|
| public final Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception Implements org. Doc from org. Resolves a method parameter into an argument value from a given request.
A
| |
| resolveEmbeddedValuesAndExpressions | back to summary |
|---|---|
| private Object resolveEmbeddedValuesAndExpressions(String value) Resolve the given annotation-specified value, potentially containing placeholders and expressions.
| |
| resolveName | back to summary |
|---|---|
| protected abstract Object resolveName(String name, MethodParameter parameter, NativeWebRequest request) throws Exception Resolve the given parameter type and value name into an argument value.
| |
| updateNamedValueInfo | back to summary |
|---|---|
| private AbstractNamedValueMethodArgumentResolver. Create a new NamedValueInfo based on the given NamedValueInfo with sanitized values. | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | hasDefaultValue(MethodParameter parameter)
Check whether the specified |
| KotlinDelegate | back to summary |
|---|---|
| private KotlinDelegate() | |
| hasDefaultValue | back to summary |
|---|---|
| public static boolean hasDefaultValue(MethodParameter parameter) Check whether the specified | |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final String | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public |
| defaultValue | back to summary |
|---|---|
| private final String defaultValue
| |
| name | back to summary |
|---|---|
| private final String name | |
| required | back to summary |
|---|---|
| private final boolean required | |
| NamedValueInfo | back to summary |
|---|---|
| public NamedValueInfo(String name, boolean required, String defaultValue) | |