Package com.github.hypfvieh.cli.parser
Class CmdArgOption.Builder<T>
java.lang.Object
com.github.hypfvieh.cli.parser.CmdArgOption.Builder<T>
- Enclosing class:
- CmdArgOption<T>
Builder for a command-line option.
The builder guarantees the option it builds is valid.
At a minimum an option requires a name.
The builder guarantees the option it builds is valid.
At a minimum an option requires a name.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Create the option object based on configuration.defaultValue(T _defaultValue) Sets the option's default value.description(String _description) Sets the option's description text.Sets option long name.optional()Sets option to be optional.Sets option to be repeatable.repeatable(boolean _repeatable) Sets option to be repeatable (true) or not (false).required()Sets option to be required.required(boolean _required) Sets option to be required or optional.Sets option short name.
-
Method Details
-
name
Sets option long name.- Parameters:
_name- name- Returns:
- this
-
shortName
Sets option short name.- Parameters:
_name- name- Returns:
- this
-
required
Sets option to be required or optional.- Parameters:
_required- true to be required- Returns:
- this
-
required
Sets option to be required.- Returns:
- this
-
optional
Sets option to be optional.- Returns:
- this
-
repeatable
Sets option to be repeatable (true) or not (false).- Parameters:
_repeatable- true to be repeatable- Returns:
- this
-
repeatable
Sets option to be repeatable.- Returns:
- this
-
defaultValue
Sets the option's default value.- Parameters:
_defaultValue- value to use, never null- Returns:
- this
-
description
Sets the option's description text.- Parameters:
_description- text to use- Returns:
- this
-
build
Create the option object based on configuration.- Returns:
- CmdArgOption
-