Class ArgumentGroupImpl
- java.lang.Object
-
- net.sourceforge.argparse4j.internal.ArgumentGroupImpl
-
- All Implemented Interfaces:
ArgumentGroup,MutuallyExclusiveGroup
public final class ArgumentGroupImpl extends java.lang.Object implements ArgumentGroup, MutuallyExclusiveGroup
The application code must not use this class directly. This class implements both mutually exclusive group and just a conceptual group.
-
-
Constructor Summary
Constructors Constructor Description ArgumentGroupImpl(ArgumentParserImpl argumentParser, java.lang.String title)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArgumentImpladdArgument(java.lang.String... nameOrFlags)Creates newArgumentand adds it to the underlining parser and returns it.ArgumentGroupImpldescription(java.lang.String description)Sets description to customize help message of this group.java.util.List<ArgumentImpl>getArgs()intgetIndex()booleanisMutex()booleanisRequired()booleanisSeparateHelp()Returns true if the help message for this group should be in separate group.voidprintHelp(java.io.PrintWriter writer, int format_width)ArgumentGroupImplrequired(boolean required)Iftrueis given, one of the arguments in this group must be specified otherwise error will be issued.voidsetIndex(int index)voidsetMutex(boolean mutex)
-
-
-
Constructor Detail
-
ArgumentGroupImpl
public ArgumentGroupImpl(ArgumentParserImpl argumentParser, java.lang.String title)
-
-
Method Detail
-
description
public ArgumentGroupImpl description(java.lang.String description)
Description copied from interface:ArgumentGroupSets description to customize help message of this group.- Specified by:
descriptionin interfaceArgumentGroup- Specified by:
descriptionin interfaceMutuallyExclusiveGroup- Parameters:
description- The description of this group.- Returns:
- this
-
addArgument
public ArgumentImpl addArgument(java.lang.String... nameOrFlags)
Description copied from interface:ArgumentGroupCreates new
Argumentand adds it to the underlining parser and returns it.See
ArgumentParser.addArgument(String...)for details.- Specified by:
addArgumentin interfaceArgumentGroup- Specified by:
addArgumentin interfaceMutuallyExclusiveGroup- Parameters:
nameOrFlags- A name or a list of option strings of newArgument.- Returns:
Argumentobject.
-
required
public ArgumentGroupImpl required(boolean required)
Description copied from interface:MutuallyExclusiveGroupIf
trueis given, one of the arguments in this group must be specified otherwise error will be issued.The default value is
false.- Specified by:
requiredin interfaceMutuallyExclusiveGroup- Parameters:
required-trueorfalse- Returns:
- this
-
printHelp
public void printHelp(java.io.PrintWriter writer, int format_width)
-
getIndex
public int getIndex()
-
setIndex
public void setIndex(int index)
-
isMutex
public boolean isMutex()
-
setMutex
public void setMutex(boolean mutex)
-
isRequired
public boolean isRequired()
-
getArgs
public java.util.List<ArgumentImpl> getArgs()
-
isSeparateHelp
public boolean isSeparateHelp()
Returns true if the help message for this group should be in separate group.- Returns:
- true if the help message for this group should be in separate group.
-
-