Package picocli
Class CommandLine.ParseResult.GroupMatch
- java.lang.Object
-
- picocli.CommandLine.ParseResult.GroupMatch
-
- Enclosing class:
- CommandLine.ParseResult
public static class CommandLine.ParseResult.GroupMatch extends java.lang.Object
A group's multiplicity specifies how many matches of a group may appear on the command line. This class models a single "match". For example, this group:(-a -b) (-a -b)
requires two matches of its arguments to fully match.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description (package private) CommandLine.ParseResult.GroupMatchContainer
container
(package private) java.util.Map<CommandLine.Model.ArgGroupSpec,CommandLine.ParseResult.GroupMatchContainer>
matchedSubgroups
(package private) java.util.Map<CommandLine.Model.ArgSpec,java.util.List<java.lang.Object>>
matchedValues
(package private) java.util.Map<CommandLine.Model.ArgSpec,java.util.Map<java.lang.Integer,java.util.List<java.lang.Object>>>
matchedValuesAtPosition
(package private) java.util.Map<CommandLine.Model.ArgSpec,java.util.List<java.lang.String>>
originalStringValues
(package private) int
position
(package private) int
startPosition
private CommandLine.ParseResult.GroupValidationResult
validationResult
-
Constructor Summary
Constructors Constructor Description GroupMatch(CommandLine.ParseResult.GroupMatchContainer container)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addMatchedValue(CommandLine.Model.ArgSpec argSpec, int matchPosition, java.lang.Object stronglyTypedValue, CommandLine.Tracer tracer)
(package private) void
addOriginalStringValue(CommandLine.Model.ArgSpec argSpec, java.lang.String value)
CommandLine.ParseResult.GroupMatchContainer
container()
Returns the containerGroupMatchContainer
of this match.CommandLine.Model.ArgGroupSpec
group()
Returns theArgGroupSpec
of the containerGroupMatchContainer
of this match.private boolean
hasFullyMatchedSubgroup(boolean allRequired)
(package private) boolean
hasMatchedValueAtPosition(CommandLine.Model.ArgSpec arg, int position)
boolean
isEmpty()
Returnstrue
if this match has no matched arguments and no matched subgroups.(package private) int
matchCount(CommandLine.Model.ArgSpec argSpec)
private boolean
matchedFully(boolean allRequired)
(package private) boolean
matchedMaxElements()
Returnstrue
if the maximum number of matches has been reached for this match: all arguments (required or not) have been matched, and for each subgroup, the maximum number of elements have been matched.(package private) boolean
matchedMinElements()
Returnstrue
if the minimum number of elements have been reached for this match: all required arguments have been matched, and for each subgroup, the minimum number of elements have been matched.java.util.Map<CommandLine.Model.ArgGroupSpec,CommandLine.ParseResult.GroupMatchContainer>
matchedSubgroups()
Returns matches for the subgroups, if any.java.util.List<java.lang.Object>
matchedValues(CommandLine.Model.ArgSpec argSpec)
Returns the values matched for the specified argument, converted to the type of the argument.java.lang.String
toString()
private java.lang.StringBuilder
toString(java.lang.StringBuilder result)
(package private) void
validate(CommandLine commandLine)
-
-
-
Field Detail
-
position
int position
-
startPosition
final int startPosition
-
container
final CommandLine.ParseResult.GroupMatchContainer container
-
matchedSubgroups
java.util.Map<CommandLine.Model.ArgGroupSpec,CommandLine.ParseResult.GroupMatchContainer> matchedSubgroups
-
matchedValues
java.util.Map<CommandLine.Model.ArgSpec,java.util.List<java.lang.Object>> matchedValues
-
originalStringValues
java.util.Map<CommandLine.Model.ArgSpec,java.util.List<java.lang.String>> originalStringValues
-
matchedValuesAtPosition
java.util.Map<CommandLine.Model.ArgSpec,java.util.Map<java.lang.Integer,java.util.List<java.lang.Object>>> matchedValuesAtPosition
-
validationResult
private CommandLine.ParseResult.GroupValidationResult validationResult
-
-
Constructor Detail
-
GroupMatch
GroupMatch(CommandLine.ParseResult.GroupMatchContainer container)
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Returnstrue
if this match has no matched arguments and no matched subgroups.
-
group
public CommandLine.Model.ArgGroupSpec group()
Returns theArgGroupSpec
of the containerGroupMatchContainer
of this match.
-
container
public CommandLine.ParseResult.GroupMatchContainer container()
Returns the containerGroupMatchContainer
of this match.
-
matchedSubgroups
public java.util.Map<CommandLine.Model.ArgGroupSpec,CommandLine.ParseResult.GroupMatchContainer> matchedSubgroups()
Returns matches for the subgroups, if any.
-
matchCount
int matchCount(CommandLine.Model.ArgSpec argSpec)
-
matchedValues
public java.util.List<java.lang.Object> matchedValues(CommandLine.Model.ArgSpec argSpec)
Returns the values matched for the specified argument, converted to the type of the argument.
-
addOriginalStringValue
void addOriginalStringValue(CommandLine.Model.ArgSpec argSpec, java.lang.String value)
-
addMatchedValue
void addMatchedValue(CommandLine.Model.ArgSpec argSpec, int matchPosition, java.lang.Object stronglyTypedValue, CommandLine.Tracer tracer)
-
hasMatchedValueAtPosition
boolean hasMatchedValueAtPosition(CommandLine.Model.ArgSpec arg, int position)
-
matchedMinElements
boolean matchedMinElements()
Returnstrue
if the minimum number of elements have been reached for this match: all required arguments have been matched, and for each subgroup, the minimum number of elements have been matched.
-
matchedMaxElements
boolean matchedMaxElements()
Returnstrue
if the maximum number of matches has been reached for this match: all arguments (required or not) have been matched, and for each subgroup, the maximum number of elements have been matched.
-
matchedFully
private boolean matchedFully(boolean allRequired)
-
hasFullyMatchedSubgroup
private boolean hasFullyMatchedSubgroup(boolean allRequired)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toString
private java.lang.StringBuilder toString(java.lang.StringBuilder result)
-
validate
void validate(CommandLine commandLine)
-
-