@Component public class StandardParameterResolver extends Object implements ParameterResolver
ShellMethod.prefix())
Method arguments can consume several words of input at once (driven by
ShellOption.arity(), default 1). If several words are consumed, they will be
joined together as a comma separated value and passed to the ConversionService
(which will typically return a List or array).
Boolean parameters are by default expected to have an arity of 0, allowing invocations
in the form rm
--force --dir /foo: the presence of --force passes true as a parameter
value, while its absence passes false. Both the default arity of 0 and the
default value of false can be overridden via ShellOption if
needed.
| Constructor and Description |
|---|
StandardParameterResolver(org.springframework.core.convert.ConversionService conversionService) |
| Modifier and Type | Method and Description |
|---|---|
List<CompletionProposal> |
complete(org.springframework.core.MethodParameter methodParameter,
CompletionContext context)
Invoked during TAB completion.
|
Stream<ParameterDescription> |
describe(org.springframework.core.MethodParameter parameter)
Describe a supported parameter, so that integrated help can be generated.
|
ValueResult |
resolve(org.springframework.core.MethodParameter methodParameter,
List<String> wordsBuffer)
Turn the given textual input into an actual object, maybe using some conversion or lookup mechanism.
|
void |
setValidatorFactory(javax.validation.ValidatorFactory validatorFactory) |
void |
setValueProviders(Collection<ValueProvider> valueProviders) |
boolean |
supports(org.springframework.core.MethodParameter parameter)
Should return true if this resolver recognizes the given method parameter (e.g. it
has the correct annotation or the correct type).
|
@Autowired public StandardParameterResolver(org.springframework.core.convert.ConversionService conversionService)
@Autowired(required=false) public void setValueProviders(Collection<ValueProvider> valueProviders)
@Autowired(required=false) public void setValidatorFactory(javax.validation.ValidatorFactory validatorFactory)
public boolean supports(org.springframework.core.MethodParameter parameter)
ParameterResolversupports in interface ParameterResolverpublic ValueResult resolve(org.springframework.core.MethodParameter methodParameter, List<String> wordsBuffer)
ParameterResolverresolve in interface ParameterResolverpublic Stream<ParameterDescription> describe(org.springframework.core.MethodParameter parameter)
ParameterResolverTypical implementations will return a one element stream result, but some may return several (for example if binding several words to a POJO).
describe in interface ParameterResolverpublic List<CompletionProposal> complete(org.springframework.core.MethodParameter methodParameter, CompletionContext context)
ParameterResolverCompletionContext can be interpreted as the start
of a supported MethodParameter value, one or several proposals should be returned.complete in interface ParameterResolverCopyright © 2018 Pivotal Software, Inc.. All rights reserved.