Class OptionMethodArgumentResolver
java.lang.Object
org.springframework.shell.support.AbstractArgumentMethodArgumentResolver
org.springframework.shell.command.annotation.support.OptionMethodArgumentResolver
- All Implemented Interfaces:
org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver
Resolver for
@Option
arguments.-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.shell.support.AbstractArgumentMethodArgumentResolver
AbstractArgumentMethodArgumentResolver.NamedValueInfo
-
Field Summary
Fields inherited from class org.springframework.shell.support.AbstractArgumentMethodArgumentResolver
ARGUMENT_PREFIX
-
Constructor Summary
ConstructorDescriptionOptionMethodArgumentResolver
(org.springframework.core.convert.ConversionService conversionService, org.springframework.beans.factory.config.ConfigurableBeanFactory beanFactory) -
Method Summary
Modifier and TypeMethodDescriptioncreateNamedValueInfo
(org.springframework.core.MethodParameter parameter) Create theAbstractArgumentMethodArgumentResolver.NamedValueInfo
object for the given method parameter.protected void
handleMissingValue
(List<String> headerName, org.springframework.core.MethodParameter parameter, org.springframework.messaging.Message<?> message) Invoked when a value is required, butAbstractArgumentMethodArgumentResolver.resolveArgumentInternal(org.springframework.core.MethodParameter, org.springframework.messaging.Message<?>, java.util.List<java.lang.String>)
returnednull
and there is no default value.protected Object
resolveArgumentInternal
(org.springframework.core.MethodParameter parameter, org.springframework.messaging.Message<?> message, List<String> names) Resolves the given parameter type and value name into an argument value.boolean
supportsParameter
(org.springframework.core.MethodParameter parameter) Methods inherited from class org.springframework.shell.support.AbstractArgumentMethodArgumentResolver
handleResolvedValue, resolveArgument
-
Constructor Details
-
OptionMethodArgumentResolver
public OptionMethodArgumentResolver(org.springframework.core.convert.ConversionService conversionService, @Nullable org.springframework.beans.factory.config.ConfigurableBeanFactory beanFactory)
-
-
Method Details
-
supportsParameter
public boolean supportsParameter(org.springframework.core.MethodParameter parameter) -
createNamedValueInfo
protected AbstractArgumentMethodArgumentResolver.NamedValueInfo createNamedValueInfo(org.springframework.core.MethodParameter parameter) Description copied from class:AbstractArgumentMethodArgumentResolver
Create theAbstractArgumentMethodArgumentResolver.NamedValueInfo
object for the given method parameter. Implementations typically retrieve the method annotation by means ofMethodParameter.getParameterAnnotation(Class)
.- Specified by:
createNamedValueInfo
in classAbstractArgumentMethodArgumentResolver
- Parameters:
parameter
- the method parameter- Returns:
- the named value information
-
resolveArgumentInternal
@Nullable protected Object resolveArgumentInternal(org.springframework.core.MethodParameter parameter, org.springframework.messaging.Message<?> message, List<String> names) throws Exception Description copied from class:AbstractArgumentMethodArgumentResolver
Resolves the given parameter type and value name into an argument value.- Specified by:
resolveArgumentInternal
in classAbstractArgumentMethodArgumentResolver
- Parameters:
parameter
- the method parameter to resolve to an argument valuemessage
- the current requestnames
- the name of the values being resolved- Returns:
- the resolved argument. May be
null
- Throws:
Exception
- in case of errors
-
handleMissingValue
protected void handleMissingValue(List<String> headerName, org.springframework.core.MethodParameter parameter, org.springframework.messaging.Message<?> message) Description copied from class:AbstractArgumentMethodArgumentResolver
Invoked when a value is required, butAbstractArgumentMethodArgumentResolver.resolveArgumentInternal(org.springframework.core.MethodParameter, org.springframework.messaging.Message<?>, java.util.List<java.lang.String>)
returnednull
and there is no default value. Sub-classes can throw an appropriate exception for this case.- Specified by:
handleMissingValue
in classAbstractArgumentMethodArgumentResolver
- Parameters:
headerName
- the name for the valueparameter
- the target method parametermessage
- the message being processed
-