Class SimpleCommandLineParser.ValueOption<X>
- java.lang.Object
-
- de.gebit.integrity.runner.console.SimpleCommandLineParser.Option
-
- de.gebit.integrity.runner.console.SimpleCommandLineParser.ValueOption<X>
-
- Type Parameters:
X
-
- Direct Known Subclasses:
SimpleCommandLineParser.DecimalOption
,SimpleCommandLineParser.IntegerOption
,SimpleCommandLineParser.LongOption
,SimpleCommandLineParser.StringOption
- Enclosing class:
- SimpleCommandLineParser
public abstract static class SimpleCommandLineParser.ValueOption<X> extends SimpleCommandLineParser.Option
A base class for an option that has one or more values. Generally, all options can have multiple values, with the first one defined being returned if only one result is requested.- Author:
- Rene Schneider - initial API and implementation
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ValueOption(java.lang.String aShortName, java.lang.String aLongName, java.lang.String aDescription, java.lang.String aCommandLine)
Creates a new value option.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
addValue(java.lang.String aValue)
Sets the value.protected void
addValueInternal(X aValue)
Adds the given value internally to the list of values.X
getValue()
X
getValue(X aDefault)
Returns the value found in the parameters from the user.java.util.List<X>
getValues()
Returns all the values found in the parameters from the user.-
Methods inherited from class de.gebit.integrity.runner.console.SimpleCommandLineParser.Option
getCommandLine, getDescription, getHelpLine, getLongName, getShortName, matches
-
-
-
-
Constructor Detail
-
ValueOption
protected ValueOption(java.lang.String aShortName, java.lang.String aLongName, java.lang.String aDescription, java.lang.String aCommandLine)
Creates a new value option.- Parameters:
aShortName
- The short name of the option. Usually just one character.aLongName
- The long name of the option, generelly a comprehendable, but not-too-long string.aDescription
- The command line help string for this option.aCommandLine
- The description for the help.
-
-
Method Detail
-
getValue
public X getValue()
-
getValue
public X getValue(X aDefault)
Returns the value found in the parameters from the user.- Parameters:
aDefault
- the default to return if the param is not set- Returns:
- the value from the user or the default
-
getValues
public java.util.List<X> getValues()
Returns all the values found in the parameters from the user.- Returns:
- the values from the user (may be an empty list if none were given)
-
addValue
protected abstract void addValue(java.lang.String aValue)
Sets the value.- Parameters:
aValue
- the value
-
addValueInternal
protected void addValueInternal(X aValue)
Adds the given value internally to the list of values.- Parameters:
aValue
- the value to add
-
-