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 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
FieldsModifier and TypeFieldDescriptionprivate final List
<ArgumentImpl> private final ArgumentParserImpl
private String
private int
Index inArgumentParserImpl
.private boolean
true if this is a mutually exclusive group.private boolean
true if one of the arguments in this group must be specified.private final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddArgument
(String... nameOrFlags) Creates newArgument
, adds it to this container and returns it.description
(String description) Sets the description for the arguments of this container.getArgs()
(package private) int
getIndex()
(package private) boolean
isMutex()
boolean
(package private) boolean
Returns true if the help message for this group should be in separate group.void
printHelp
(PrintWriter writer, int format_width) required
(boolean required) Iftrue
is given, one of the arguments in this group must be specified otherwise error will be issued.(package private) void
setIndex
(int index) (package private) void
setMutex
(boolean mutex)
-
Field Details
-
index_
private int index_Index inArgumentParserImpl
. -
title_
-
description_
-
argumentParser_
-
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 Details
-
ArgumentGroupImpl
ArgumentGroupImpl(ArgumentParserImpl argumentParser, String title)
-
-
Method Details
-
description
Description copied from interface:ArgumentContainer
Sets the description for the arguments of this container.- Specified by:
description
in interfaceArgumentContainer
- Specified by:
description
in interfaceArgumentGroup
- Specified by:
description
in interfaceMutuallyExclusiveGroup
- Parameters:
description
- The description of this container.- Returns:
- this
-
addArgument
Description copied from interface:ArgumentContainer
Creates new
Argument
, adds it to this container and returns it.The
nameOrFlags
is either a single name of positional argument or a list of option strings for named argument, e.g.foo
or-f, --foo
.- Specified by:
addArgument
in interfaceArgumentContainer
- Parameters:
nameOrFlags
- A name or a list of option strings of newArgument
.- Returns:
Argument
object.
-
required
Description copied from interface:MutuallyExclusiveGroup
If
true
is given, one of the arguments in this group must be specified otherwise error will be issued.The default value is
false
.- Specified by:
required
in interfaceMutuallyExclusiveGroup
- Parameters:
required
-true
orfalse
- Returns:
- this
-
printHelp
-
getIndex
int getIndex() -
setIndex
void setIndex(int index) -
isMutex
boolean isMutex() -
setMutex
void setMutex(boolean mutex) -
isRequired
public boolean isRequired() -
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.
-