|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opends.server.util.args.SubCommand
public class SubCommand
This class defines a data structure for holding information about a subcommand that may be used with the subcommand argument parser. The subcommand has a name, a description, and a set of arguments.
Constructor Summary | |
---|---|
SubCommand(SubCommandArgumentParser parser,
java.lang.String name,
boolean allowsTrailingArguments,
int minTrailingArguments,
int maxTrailingArguments,
java.lang.String trailingArgsDisplayName,
Message description)
Creates a new subcommand with the provided information. |
|
SubCommand(SubCommandArgumentParser parser,
java.lang.String name,
Message description)
Creates a new subcommand with the provided information. |
Method Summary | |
---|---|
void |
addArgument(Argument argument)
Adds the provided argument for use with this subcommand. |
boolean |
allowsTrailingArguments()
Indicates whether this sub-command will allow unnamed trailing arguments. |
Argument |
getArgument(java.lang.Character shortID)
Retrieves the subcommand argument with the specified short identifier. |
Argument |
getArgument(java.lang.String longID)
Retrieves the subcommand argument with the specified long identifier. |
Argument |
getArgumentForName(java.lang.String name)
Retrieves the subcommand argument with the specified name. |
java.util.LinkedList<Argument> |
getArguments()
Retrieves the set of arguments for this subcommand. |
Message |
getDescription()
Retrieves the description for this subcommand. |
int |
getMaxTrailingArguments()
Retrieves the maximum number of unnamed trailing arguments that may be provided. |
int |
getMinTrailingArguments()
Retrieves the minimum number of unnamed trailing arguments that must be provided. |
java.lang.String |
getName()
Retrieves the name of this subcommand. |
java.util.ArrayList<java.lang.String> |
getTrailingArguments()
Retrieves the set of unnamed trailing arguments that were provided on the command line. |
java.lang.String |
getTrailingArgumentsDisplayName()
Retrieves the trailing arguments display name. |
boolean |
isHidden()
Indicates whether this subcommand should be hidden from the usage information. |
void |
setHidden(boolean isHidden)
Specifies whether this subcommand should be hidden from the usage information. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SubCommand(SubCommandArgumentParser parser, java.lang.String name, Message description) throws ArgumentException
parser
- The argument parser with which this subcommand is
associated.name
- The name of this subcommand.description
- The description of this subcommand.
ArgumentException
- If the associated argument parser already has a
subcommand with the same name.public SubCommand(SubCommandArgumentParser parser, java.lang.String name, boolean allowsTrailingArguments, int minTrailingArguments, int maxTrailingArguments, java.lang.String trailingArgsDisplayName, Message description) throws ArgumentException
parser
- The argument parser with which this subcommand is
associated.name
- The name of this subcommand.allowsTrailingArguments
- Indicates whether this parser allows unnamed trailing
arguments to be provided.minTrailingArguments
- The minimum number of unnamed trailing arguments that
must be provided. A value less than or equal to zero
indicates that no minimum will be enforced.maxTrailingArguments
- The maximum number of unnamed trailing arguments that
may be provided. A value less than or equal to zero
indicates that no maximum will be enforced.trailingArgsDisplayName
- The display name that should be used as a placeholder
for unnamed trailing arguments in the generated usage
information.description
- The description of this subcommand.
ArgumentException
- If the associated argument parser already has a
subcommand with the same name.Method Detail |
---|
public java.lang.String getName()
public Message getDescription()
public java.util.LinkedList<Argument> getArguments()
public Argument getArgument(java.lang.Character shortID)
shortID
- The short identifier of the argument to retrieve.
null
if there is none.public Argument getArgument(java.lang.String longID)
longID
- The long identifier of the argument to retrieve.
null
if there is none.public Argument getArgumentForName(java.lang.String name)
name
- The name of the argument to retrieve.
null
if there is no such argument.public void addArgument(Argument argument) throws ArgumentException
argument
- The argument to add for use with this subcommand.
ArgumentException
- If either the short ID or long ID for the
argument conflicts with that of another
argument already associated with this
subcommand.public boolean allowsTrailingArguments()
true
if this sub-command allows unnamed
trailing arguments, or false
if it does
not.public int getMinTrailingArguments()
public int getMaxTrailingArguments()
public java.lang.String getTrailingArgumentsDisplayName()
public java.util.ArrayList<java.lang.String> getTrailingArguments()
public boolean isHidden()
true
if this subcommand should be hidden
from the usage information, or false
if
not.public void setHidden(boolean isHidden)
isHidden
- Indicates whether this subcommand should be hidden from
the usage information.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |