Module net.sourceforge.argparse4j
Class ArgumentGroupImpl
- java.lang.Object
-
- net.sourceforge.argparse4j.internal.ArgumentGroupImpl
-
- All Implemented Interfaces:
ArgumentContainer,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.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ArgumentImpl>args_private ArgumentParserImplargumentParser_private java.lang.Stringdescription_private intindex_Index inArgumentParserImpl.private booleanmutex_true if this is a mutually exclusive group.private booleanrequired_true if one of the arguments in this group must be specified.private java.lang.Stringtitle_
-
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 newArgument, adds it to this container and returns it.ArgumentGroupImpldescription(java.lang.String description)Sets the description for the arguments of this container.java.util.List<ArgumentImpl>getArgs()(package private) intgetIndex()(package private) booleanisMutex()booleanisRequired()(package private) 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.(package private) voidsetIndex(int index)(package private) voidsetMutex(boolean mutex)
-
-
-
Field Detail
-
index_
private int index_
Index inArgumentParserImpl.
-
title_
private final java.lang.String title_
-
description_
private java.lang.String description_
-
argumentParser_
private final ArgumentParserImpl argumentParser_
-
args_
private final java.util.List<ArgumentImpl> args_
-
mutex_
private boolean mutex_
true if this is a mutually exclusive group.
-
required_
private boolean required_
true if one of the arguments in this group must be specified.
-
-
Constructor Detail
-
ArgumentGroupImpl
ArgumentGroupImpl(ArgumentParserImpl argumentParser, java.lang.String title)
-
-
Method Detail
-
description
public ArgumentGroupImpl description(java.lang.String description)
Description copied from interface:ArgumentContainerSets the description for the arguments of this container.- Specified by:
descriptionin interfaceArgumentContainer- Specified by:
descriptionin interfaceArgumentGroup- Specified by:
descriptionin interfaceMutuallyExclusiveGroup- Parameters:
description- The description of this container.- Returns:
- this
-
addArgument
public ArgumentImpl addArgument(java.lang.String... nameOrFlags)
Description copied from interface:ArgumentContainerCreates new
Argument, adds it to this container and returns it.The
nameOrFlagsis either a single name of positional argument or a list of option strings for named argument, e.g.fooor-f, --foo.- Specified by:
addArgumentin interfaceArgumentContainer- 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
int getIndex()
-
setIndex
void setIndex(int index)
-
isMutex
boolean isMutex()
-
setMutex
void setMutex(boolean mutex)
-
isRequired
public boolean isRequired()
-
getArgs
public java.util.List<ArgumentImpl> getArgs()
-
isSeparateHelp
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.
-
-