@PublicEvolving public class RequiredParameters extends Object
| Constructor and Description |
|---|
RequiredParameters() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Option option)
Add a parameter encapsulated in an
Option object. |
Option |
add(String name)
Add a parameter based on its name.
|
void |
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
If any check fails, a RequiredParametersException is thrown
|
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 void applyTo(ParameterTool parameterTool) throws RequiredParametersException
parameterTool - - parameters supplied by the user.RequiredParametersException - if any of the specified checks failpublic String getHelp()
public String getHelp(List<String> missingArguments)
missingArguments - - a list of missing parametersCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.