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.ObjectA 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.GroupMatchContainercontainer(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) intposition(package private) intstartPositionprivate CommandLine.ParseResult.GroupValidationResultvalidationResult
-
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) voidaddMatchedValue(CommandLine.Model.ArgSpec argSpec, int matchPosition, java.lang.Object stronglyTypedValue, CommandLine.Tracer tracer)(package private) voidaddOriginalStringValue(CommandLine.Model.ArgSpec argSpec, java.lang.String value)CommandLine.ParseResult.GroupMatchContainercontainer()Returns the containerGroupMatchContainerof this match.CommandLine.Model.ArgGroupSpecgroup()Returns theArgGroupSpecof the containerGroupMatchContainerof this match.private booleanhasFullyMatchedSubgroup(boolean allRequired)(package private) booleanhasMatchedValueAtPosition(CommandLine.Model.ArgSpec arg, int position)booleanisEmpty()Returnstrueif this match has no matched arguments and no matched subgroups.(package private) intmatchCount(CommandLine.Model.ArgSpec argSpec)private booleanmatchedFully(boolean allRequired)(package private) booleanmatchedMaxElements()Returnstrueif 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) booleanmatchedMinElements()Returnstrueif 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.StringtoString()private java.lang.StringBuildertoString(java.lang.StringBuilder result)(package private) voidvalidate(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()
Returnstrueif this match has no matched arguments and no matched subgroups.
-
group
public CommandLine.Model.ArgGroupSpec group()
Returns theArgGroupSpecof the containerGroupMatchContainerof this match.
-
container
public CommandLine.ParseResult.GroupMatchContainer container()
Returns the containerGroupMatchContainerof 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()
Returnstrueif 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()
Returnstrueif 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:
toStringin classjava.lang.Object
-
toString
private java.lang.StringBuilder toString(java.lang.StringBuilder result)
-
validate
void validate(CommandLine commandLine)
-
-