Subclasses only need to define specific steps such as how to obtain named value details from a method parameter, how to resolve to argument values, or how to handle missing values.
A default value string can contain ${...} placeholders and Spring
Expression Language #{...} expressions which will be resolved if a
ConfigurableBeanFactory is supplied to the class constructor.
A ConversionService is used to convert a resolved String argument
value to the expected target method parameter type.
| Modifier and Type | Class and Description |
|---|---|
| protected static class | AbstractNamedValueMethodArgumentResolver.
Represents a named value declaration. |
| Modifier and Type | Field and Description |
|---|---|
| private final ConfigurableBeanFactory | |
| private final ConversionService | |
| private final BeanExpressionContext | |
| private final Map |
| Access | Constructor and Description |
|---|---|
| protected | AbstractNamedValueMethodArgumentResolver(ConversionService
conversion service for converting String values
to the target method parameter type conversionService, ConfigurableBeanFactory a bean factory for resolving beanFactory)${...}
placeholders and #{...} SpEL expressions in default valuesConstructor with a |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract AbstractNamedValueMethodArgumentResolver. | Returns: the named value informationthe method parameter parameter)Create the |
| private AbstractNamedValueMethodArgumentResolver. | |
| protected abstract void | handleMissingValue(String
the name for the value name, MethodParameter the target method parameter parameter, Message<?> the message being processed message)Invoked when a value is required, but |
| private Object | handleNullValue(String name, Object value, Class<?> paramType)
One last chance to handle a possible null value. |
| protected abstract Object | Returns: the resolved argument. May benullthe method parameter to resolve to an argument value parameter, Message<?> the current request message, String the name of the value being resolved name)Resolves the given parameter type and value name into an argument value. |
| public Object | resolveArgumentValue(MethodParameter
the method parameter parameter, Message<?> the currently processed message message)
Resolve the value for the method parameter synchronously. |
| private Object | resolveEmbeddedValuesAndExpressions(String value)
Resolve the given annotation-specified value, potentially containing placeholders and expressions. |
| private AbstractNamedValueMethodArgumentResolver. | updateNamedValueInfo(MethodParameter parameter, AbstractNamedValueMethodArgumentResolver.
Fall back on the parameter name from the class file if necessary and
replace |
| configurableBeanFactory | back to summary |
|---|---|
| private final ConfigurableBeanFactory configurableBeanFactory
| |
| conversionService | back to summary |
|---|---|
| private final ConversionService conversionService | |
| expressionContext | back to summary |
|---|---|
| private final BeanExpressionContext expressionContext
| |
| namedValueInfoCache | back to summary |
|---|---|
| private final Map<MethodParameter, AbstractNamedValueMethodArgumentResolver. | |
| AbstractNamedValueMethodArgumentResolver | back to summary |
|---|---|
| protected AbstractNamedValueMethodArgumentResolver(ConversionService conversionService, ConfigurableBeanFactory beanFactory) Constructor with a
| |
| 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 abstract void handleMissingValue(String name, MethodParameter parameter, Message<?> message) Invoked when a value is required, but
| |
| handleNullValue | back to summary |
|---|---|
| private Object handleNullValue(String name, Object value, Class<?> paramType) One last chance to handle a possible null value.
Specifically for booleans method parameters, use
| |
| resolveArgumentInternal | back to summary |
|---|---|
| protected abstract Object resolveArgumentInternal(MethodParameter parameter, Message<?> message, String name) Resolves the given parameter type and value name into an argument value.
| |
| resolveArgumentValue | back to summary |
|---|---|
| public Object resolveArgumentValue(MethodParameter parameter, Message<?> message) Resolve the value for the method parameter synchronously.
| |
| resolveEmbeddedValuesAndExpressions | back to summary |
|---|---|
| private Object resolveEmbeddedValuesAndExpressions(String value) Resolve the given annotation-specified value, potentially containing placeholders and expressions.
| |
| updateNamedValueInfo | back to summary |
|---|---|
| private AbstractNamedValueMethodArgumentResolver. Fall back on the parameter name from the class file if necessary and
replace | |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final String | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| protected |
| 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 |
|---|---|
| protected NamedValueInfo(String name, boolean required, String defaultValue) | |