If a command accepts any and all parameter types and values, it does not need to define a set of parameter definitions. However, if a command accepts only a certain set of parameters, it must define a set of parameter definitions that determine the validity of a command's parameter values.
Note that command implementors are recommended to provide a set of parameter setter methods should they require parameters in order to be able to execute. This will allow a strongly-typed mechanism to be available in order to set parameters (as opposed to asking the client to add Object values to a weakly-typed map and/or checking the parameter definitions to ensure the parameter values are valid). It is highly recommended that the implementors of this interface define setter methods that take Objects as opposed to primitives (e.g. Integer
vs. int
) to make it easier for cmdline clients to {@link ParameterDefinition#convertObject(Object) convert} fromtext-based input to the Java representations of the actual data types needed.
|
|
|
|