Package nz.org.riskscape.picocli
Class CommandLine.Model.ArgGroupSpec.Builder
java.lang.Object
nz.org.riskscape.picocli.CommandLine.Model.ArgGroupSpec.Builder
- Enclosing class:
- CommandLine.Model.ArgGroupSpec
Builder responsible for creating valid
ArgGroupSpec
objects.- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptionAdds the specified argument to the list of options and positional parameters that depend on this group.Adds the specified group to the list of subgroups that this group is composed of.args()
Returns the list of options and positional parameters that depend on this group.build()
Returns a validArgGroupSpec
instance.boolean
Returns whether this is a mutually exclusive group;true
by default.exclusive
(boolean newValue) Sets whether this is a mutually exclusive group;true
by default.getter()
Returns theCommandLine.Model.IGetter
that is responsible for supplying the value of the annotated program element associated with this group.getter
(CommandLine.Model.IGetter getter) Sets theCommandLine.Model.IGetter
that is responsible for getting the value of the annotated program element associated with this group, and returns this builder.heading()
Returns the heading of this group, used when generating the usage documentation.Sets the heading of this group (may benull
), used when generating the usage documentation.Returns the heading key of this group, used to get the heading from a resource bundle.headingKey
(String newValue) Sets the heading key of this group, used to get the heading from a resource bundle.Returns the multiplicity of this group: how many occurrences it may have on the command line;"0..1"
(optional) by default.multiplicity
(String newValue) Sets the multiplicity of this group: how many occurrences it may have on the command line;"0..1"
(optional) by default.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.int
order()
Returns the position in the options list in the usage help message at which this group should be shown.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.scope()
Returns theCommandLine.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.scope
(CommandLine.Model.IScope scope) Sets theCommandLine.Model.IScope
that targets where the setter sets the value of the annotated program element associated with this group, and returns this builder.setter()
Returns theCommandLine.Model.ISetter
that is responsible for modifying the value of the annotated program element associated with this group.setter
(CommandLine.Model.ISetter setter) Sets theCommandLine.Model.ISetter
that is responsible for modifying the value of the annotated program element associated with this group, and returns this builder.Returns the list of subgroups that this group is composed of.typeInfo()
Returns the type info for the annotated program element associated with this group.typeInfo
(CommandLine.Model.ITypeInfo newValue) Sets the type info for the annotated program element associated with this group, and returns this builder.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-ocurring group this means that all arguments in the group are specified on the command line.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-ocurring group this means that all arguments in the group are specified on the command line.
-
Method Details
-
updateArgGroupAttributes
Updates this builder from the specified annotation values.- Parameters:
group
- annotation values- Returns:
- this builder for method chaining
-
build
Returns a validArgGroupSpec
instance. -
exclusive
public boolean exclusive()Returns whether this is a mutually exclusive group;true
by default. Iffalse
, this is a co-occurring group. Ignored ifvalidate()
isfalse
.- See Also:
-
exclusive
Sets whether this is a mutually exclusive group;true
by default. Iffalse
, this is a co-occurring group. Ignored ifvalidate()
isfalse
.- See Also:
-
multiplicity
Returns the multiplicity of this group: how many occurrences it may have on the command line;"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 ifvalidate()
isfalse
.- See Also:
-
multiplicity
Sets the multiplicity of this group: how many occurrences it may have on the command line;"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 ifvalidate()
isfalse
.- See Also:
-
multiplicity
Sets the multiplicity of this group: how many occurrences it may have on the command line;"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 ifvalidate()
isfalse
.- See Also:
-
validate
public 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-ocurring group this means that all arguments in the group are specified on the command line.true
by default.- See Also:
-
validate
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-ocurring group this means that all arguments in the group are specified on the command line.true
by default.- See Also:
-
order
public int order()Returns the position in the options list in the usage help message at which this group should be shown. Groups with a lower number are shown before groups with a higher number. This attribute is only honored for groups that have aheading
(or aheadingKey
with a non-null
resource bundle value). -
order
Sets the position in the options list in the usage help message at which this group should be shown, and returns this builder. -
heading
Returns the heading of this group, used when generating the usage documentation.- See Also:
-
heading
Sets the heading of this group (may benull
), used when generating the usage documentation.- See Also:
-
headingKey
Returns the heading key of this group, used to get the heading from a resource bundle.- See Also:
-
headingKey
Sets the heading key of this group, used to get the heading from a resource bundle.- See Also:
-
typeInfo
Returns the type info for the annotated program element associated with this group.- Returns:
- type information that does not require
Class
objects and be constructed both at runtime and compile time
-
typeInfo
Sets the type info for the annotated program element associated with this group, and returns this builder.- Parameters:
newValue
- type information that does not requireClass
objects and be constructed both at runtime and compile time
-
getter
Returns theCommandLine.Model.IGetter
that is responsible for supplying the value of the annotated program element associated with this group. -
getter
Sets theCommandLine.Model.IGetter
that is responsible for getting the value of the annotated program element associated with this group, and returns this builder. -
setter
Returns theCommandLine.Model.ISetter
that is responsible for modifying the value of the annotated program element associated with this group. -
setter
Sets theCommandLine.Model.ISetter
that is responsible for modifying the value of the annotated program element associated with this group, and returns this builder. -
scope
Returns theCommandLine.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. -
scope
Sets theCommandLine.Model.IScope
that targets where the setter sets the value of the annotated program element associated with this group, and returns this builder. -
addArg
Adds the specified argument to the list of options and positional parameters that depend on this group. -
args
Returns the list of options and positional parameters that depend on this group. -
addSubgroup
Adds the specified group to the list of subgroups that this group is composed of. -
subgroups
Returns the list of subgroups that this group is composed of.
-