public static class CommandLine.Model.ArgGroupSpec.Builder extends Object
ArgGroupSpec
objects.Modifier and Type | Method and Description |
---|---|
CommandLine.Model.ArgGroupSpec.Builder |
addArg(CommandLine.Model.ArgSpec arg)
Adds the specified argument to the list of options and positional parameters that depend on this group.
|
CommandLine.Model.ArgGroupSpec.Builder |
addSpecElement(CommandLine.Model.IAnnotatedElement element)
Adds the specified
{@literal @}Spec annotated program element to the list of spec elements for this group. |
CommandLine.Model.ArgGroupSpec.Builder |
addSubgroup(CommandLine.Model.ArgGroupSpec group)
Adds the specified group to the list of subgroups that this group is composed of.
|
List<CommandLine.Model.ArgSpec> |
args()
Returns the list of options and positional parameters that depend on this group.
|
CommandLine.Model.ArgGroupSpec |
build()
Returns a valid
ArgGroupSpec instance. |
boolean |
exclusive()
Returns whether this is a mutually exclusive group;
true by default. |
CommandLine.Model.ArgGroupSpec.Builder |
exclusive(boolean newValue)
Sets whether this is a mutually exclusive group;
true by default. |
CommandLine.Model.IGetter |
getter()
Returns the
CommandLine.Model.IGetter that is responsible for supplying the value of the annotated program element associated with this group. |
CommandLine.Model.ArgGroupSpec.Builder |
getter(CommandLine.Model.IGetter getter)
Sets the
CommandLine.Model.IGetter that is responsible for getting the value of the annotated program element associated with this group, and returns this builder. |
String |
heading()
Returns the heading of this group, used when generating the usage documentation.
|
CommandLine.Model.ArgGroupSpec.Builder |
heading(String newValue)
Sets the heading of this group (may be
null ), used when generating the usage documentation. |
String |
headingKey()
Returns the heading key of this group, used to get the heading from a resource bundle.
|
CommandLine.Model.ArgGroupSpec.Builder |
headingKey(String newValue)
Sets the heading key of this group, used to get the heading from a resource bundle.
|
CommandLine.Range |
multiplicity()
Returns the multiplicity of this group: how many occurrences it may have on the command line;
"0..1" (optional) by default. |
CommandLine.Model.ArgGroupSpec.Builder |
multiplicity(CommandLine.Range newValue)
Sets the multiplicity of this group: how many occurrences it may have on the command line;
"0..1" (optional) by default. |
CommandLine.Model.ArgGroupSpec.Builder |
multiplicity(String newValue)
Sets the multiplicity of this group: how many occurrences it may have on the command line;
"0..1" (optional) by default. |
int |
order()
Returns the position in the options list in the usage help message at which this group should be shown.
|
CommandLine.Model.ArgGroupSpec.Builder |
order(int order)
Sets the position in the options list in the usage help message at which this group should be shown, and returns this builder.
|
CommandLine.Model.IScope |
scope()
Returns the
CommandLine.Model.IScope that determines where the setter sets the value (or the getter gets the value) of the annotated program element associated with this group. |
CommandLine.Model.ArgGroupSpec.Builder |
scope(CommandLine.Model.IScope scope)
Sets the
CommandLine.Model.IScope that targets where the setter sets the value of the annotated program element associated with this group, and returns this builder. |
CommandLine.Model.ISetter |
setter()
Returns the
CommandLine.Model.ISetter that is responsible for modifying the value of the annotated program element associated with this group. |
CommandLine.Model.ArgGroupSpec.Builder |
setter(CommandLine.Model.ISetter setter)
Sets the
CommandLine.Model.ISetter that is responsible for modifying the value of the annotated program element associated with this group, and returns this builder. |
List<CommandLine.Model.IAnnotatedElement> |
specElements()
Returns the list of program elements annotated with
{@literal @}Spec configured for this group. |
List<CommandLine.Model.ArgGroupSpec> |
subgroups()
Returns the list of subgroups that this group is composed of.
|
CommandLine.Model.ITypeInfo |
typeInfo()
Returns the type info for the annotated program element associated with this group.
|
CommandLine.Model.ArgGroupSpec.Builder |
typeInfo(CommandLine.Model.ITypeInfo newValue)
Sets the type info for the annotated program element associated with this group, and returns this builder.
|
CommandLine.Model.ArgGroupSpec.Builder |
updateArgGroupAttributes(CommandLine.ArgGroup group)
Updates this builder from the specified annotation values.
|
boolean |
validate()
Returns whether picocli should validate the rules of this group:
for a mutually exclusive group this means that no more than one arguments in the group is specified on the command line;
for a co-occurring group this means that all arguments in the group are specified on the command line.
|
CommandLine.Model.ArgGroupSpec.Builder |
validate(boolean newValue)
Sets whether picocli should validate the rules of this group:
for a mutually exclusive group this means that no more than one arguments in the group is specified on the command line;
for a co-occurring group this means that all arguments in the group are specified on the command line.
|
public CommandLine.Model.ArgGroupSpec.Builder updateArgGroupAttributes(CommandLine.ArgGroup group)
group
- annotation valuespublic CommandLine.Model.ArgGroupSpec build()
ArgGroupSpec
instance.public boolean exclusive()
true
by default.
If false
, this is a co-occurring group. Ignored if validate()
is false
.CommandLine.ArgGroup.exclusive()
public CommandLine.Model.ArgGroupSpec.Builder exclusive(boolean newValue)
true
by default.
If false
, this is a co-occurring group. Ignored if validate()
is false
.CommandLine.ArgGroup.exclusive()
public CommandLine.Range multiplicity()
"0..1"
(optional) by default.
A group can be made required by specifying a multiplicity of "1"
. For a group of mutually exclusive arguments,
being required means that one of the arguments in the group must appear on the command line, or a MissingParameterException is thrown.
For a group of co-occurring arguments, being required means that all arguments in the group must appear on the command line.
Ignored if validate()
is false
.CommandLine.ArgGroup.multiplicity()
public CommandLine.Model.ArgGroupSpec.Builder multiplicity(String newValue)
"0..1"
(optional) by default.
A group can be made required by specifying a multiplicity of "1"
. For a group of mutually exclusive arguments,
being required means that one of the arguments in the group must appear on the command line, or a MissingParameterException is thrown.
For a group of co-occurring arguments, being required means that all arguments in the group must appear on the command line.
Ignored if validate()
is false
.CommandLine.ArgGroup.multiplicity()
public CommandLine.Model.ArgGroupSpec.Builder multiplicity(CommandLine.Range newValue)
"0..1"
(optional) by default.
A group can be made required by specifying a multiplicity of "1"
. For a group of mutually exclusive arguments,
being required means that one of the arguments in the group must appear on the command line, or a MissingParameterException is thrown.
For a group of co-occurring arguments, being required means that all arguments in the group must appear on the command line.
Ignored if validate()
is false
.CommandLine.ArgGroup.multiplicity()
public boolean validate()
true
by default.CommandLine.ArgGroup.validate()
public CommandLine.Model.ArgGroupSpec.Builder validate(boolean newValue)
true
by default.CommandLine.ArgGroup.validate()
public int order()
heading
(or a headingKey
with a non-null
resource bundle value).public CommandLine.Model.ArgGroupSpec.Builder order(int order)
public String heading()
CommandLine.ArgGroup.heading()
public CommandLine.Model.ArgGroupSpec.Builder heading(String newValue)
null
), used when generating the usage documentation.CommandLine.ArgGroup.heading()
public String headingKey()
CommandLine.ArgGroup.headingKey()
public CommandLine.Model.ArgGroupSpec.Builder headingKey(String newValue)
CommandLine.ArgGroup.headingKey()
public CommandLine.Model.ITypeInfo typeInfo()
Class
objects and be constructed both at runtime and compile timepublic CommandLine.Model.ArgGroupSpec.Builder typeInfo(CommandLine.Model.ITypeInfo newValue)
newValue
- type information that does not require Class
objects and be constructed both at runtime and compile timepublic CommandLine.Model.IGetter getter()
CommandLine.Model.IGetter
that is responsible for supplying the value of the annotated program element associated with this group.public CommandLine.Model.ArgGroupSpec.Builder getter(CommandLine.Model.IGetter getter)
CommandLine.Model.IGetter
that is responsible for getting the value of the annotated program element associated with this group, and returns this builder.public CommandLine.Model.ISetter setter()
CommandLine.Model.ISetter
that is responsible for modifying the value of the annotated program element associated with this group.public CommandLine.Model.ArgGroupSpec.Builder setter(CommandLine.Model.ISetter setter)
CommandLine.Model.ISetter
that is responsible for modifying the value of the annotated program element associated with this group, and returns this builder.public CommandLine.Model.IScope scope()
CommandLine.Model.IScope
that determines where the setter sets the value (or the getter gets the value) of the annotated program element associated with this group.public CommandLine.Model.ArgGroupSpec.Builder scope(CommandLine.Model.IScope scope)
CommandLine.Model.IScope
that targets where the setter sets the value of the annotated program element associated with this group, and returns this builder.public CommandLine.Model.ArgGroupSpec.Builder addArg(CommandLine.Model.ArgSpec arg)
public List<CommandLine.Model.ArgSpec> args()
public CommandLine.Model.ArgGroupSpec.Builder addSubgroup(CommandLine.Model.ArgGroupSpec group)
public List<CommandLine.Model.ArgGroupSpec> subgroups()
public CommandLine.Model.ArgGroupSpec.Builder addSpecElement(CommandLine.Model.IAnnotatedElement element)
{@literal @}Spec
annotated program element to the list of spec elements for this group.public List<CommandLine.Model.IAnnotatedElement> specElements()
{@literal @}Spec
configured for this group.