ParameterTool or a third-party
command line parsing library instead.@Deprecated public class RequiredParameters extends Object
| 构造器和说明 |
|---|
RequiredParameters()
已过时。
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add(Option option)
已过时。
Add a parameter encapsulated in an
Option object. |
Option |
add(String name)
已过时。
Add a parameter based on its name.
|
ParameterTool |
applyTo(ParameterTool parameterTool)
已过时。
Check for all required parameters defined:
- has a value been passed
- if not, does the parameter have an associated default value
- does the type of the parameter match the one defined in RequiredParameters
- does the value provided in the parameterTool adhere to the choices defined in the option.
|
String |
getHelp()
已过时。
Build a help text for the defined parameters.
|
String |
getHelp(List<String> missingArguments)
已过时。
Build a help text for the defined parameters and list the missing arguments at the end of the text.
|
public Option add(String name) throws RequiredParametersException
name - - the name of the parameterOption object representing the parameterRequiredParametersException - if an option with the same name is already definedpublic void add(Option option) throws RequiredParametersException
Option object.option - - the parameterRequiredParametersException - if an option with the same name is already definedpublic ParameterTool applyTo(ParameterTool parameterTool) throws RequiredParametersException
If any check fails, a RequiredParametersException is thrown
parameterTool - - parameters supplied by the user.RequiredParametersException - if any of the specified checks failpublic String getHelp()
The format of the help text will be: Required Parameters: \t -:shortName:, --:name: \t :helpText: \t default: :defaultValue: \t choices: :choices: \n
public String getHelp(List<String> missingArguments)
The format of the help text will be: Required Parameters: \t -:shortName:, --:name: \t :helpText: \t default: :defaultValue: \t choices: :choices: \n
Missing parameters: \t param1 param2 ... paramN
missingArguments - - a list of missing parametersCopyright © 2014–2021 The Apache Software Foundation. All rights reserved.