public final class CommandlineArguments extends Object implements Serializable
| Modifier and Type | Field and Description | 
|---|---|
static int | 
FLAG_TYPE_MULTIPLEARGS
flag type enum, to indicate that the flag is followed
 by potentially multiple arguments. 
 | 
static int | 
FLAG_TYPE_NOARGS
flag type enum, to indicate that the flag doesn't take
 any arguments. 
 | 
static int | 
FLAG_TYPE_RESTOFARGS
flag type enum, to indicate that the rest of the commandline 
 is the arg for this flag. 
 | 
static int | 
FLAG_TYPE_SINGLEARG
flag type enum, to indicate that the flag is followed
 by a single argument. 
 | 
| Constructor and Description | 
|---|
CommandlineArguments(String commandline)
Constructs an CommandlineArguments, with no flags. 
 | 
CommandlineArguments(String[] args)
Constructs an CommandlineArguments, with no flags. 
 | 
CommandlineArguments(String[] flags,
                    boolean[] canHaveArgs,
                    String commandline)
Constructs an CommandlineArguments, with specifications as to the legal
 flags. 
 | 
CommandlineArguments(String[] flags,
                    boolean[] canHaveArgs,
                    String[] args)
Constructs an CommandlineArguments, with specifications as to the legal
 flags. 
 | 
CommandlineArguments(String[] flags,
                    int[] flagDescriptors,
                    String commandline)
Constructs an CommandlineArguments, with specifications as to the legal
 flags. 
 | 
CommandlineArguments(String[] flags,
                    int[] flagDescriptors,
                    String[] args)
Constructs an CommandlineArguments, with specifications as to the legal
 flags. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
Argument[] | 
getFlaggedArguments()
Returns the set of flagged arguments from the parsed commandline. 
 | 
int | 
getFlaggedArgumentsCount()
Returns the count of flagged arguments from the parsed commandline. 
 | 
Argument[] | 
getPositionalArguments()
Returns the set of positional arguments from the parsed commandline. 
 | 
int | 
getPositionalArgumentsCount()
Returns the count of positional arguments from the parsed commandline. 
 | 
String | 
getPositionalArgumentValue(int index)
Returns a specific positional argument value as a String,
 from the parsed commandline. 
 | 
String[] | 
getPositionalArgumentValues()
Returns the set of positional arguments values as Strings
 from the parsed commandline. 
 | 
static String | 
getSimpleCommandArgument(String cmdline)
return the substring after the first token of a commandline. 
 | 
static String | 
getSimpleCommandToken(String cmdline)
return first token of a commandline. 
 | 
public static final int FLAG_TYPE_NOARGS
public static final int FLAG_TYPE_SINGLEARG
public static final int FLAG_TYPE_MULTIPLEARGS
public static final int FLAG_TYPE_RESTOFARGS
public CommandlineArguments(String[] flags, boolean[] canHaveArgs, String[] args)
flags - the list of valid flagscanHaveArgs - indication as to whether the flags support an argumentargs - the set of commandline args to convertif - invalid args are specifiedpublic CommandlineArguments(String[] flags, boolean[] canHaveArgs, String commandline)
flags - the list of valid flagscanHaveArgs - indication as to whether the flags support an argumentcommandline - untokenized commandlineif - invalid args are specifiedpublic CommandlineArguments(String[] flags, int[] flagDescriptors, String[] args)
flags - the list of valid flagsflagDescriptors - description of the flagsargs - the set of commandline args to convertif - invalid args are specifiedpublic CommandlineArguments(String[] flags, int[] flagDescriptors, String commandline)
flags - the list of valid flagsflagDescriptors - description of the flagscommandline - untokenized commandlineif - invalid args are specifiedpublic CommandlineArguments(String[] args)
args - the set of commandline args to convertif - invalid args are specifiedpublic CommandlineArguments(String commandline)
commandline - untokenized commandlineif - invalid args are specifiedpublic Argument[] getPositionalArguments()
if - invalid args are specifiedpublic int getPositionalArgumentsCount()
if - invalid args are specifiedpublic String getPositionalArgumentValue(int index)
index - The requested positional argument.if - invalid args are specifiedpublic String[] getPositionalArgumentValues()
if - invalid args are specifiedpublic Argument[] getFlaggedArguments()
if - invalid args are specifiedpublic int getFlaggedArgumentsCount()
if - invalid args are specifiedpublic static String getSimpleCommandToken(String cmdline)
public static String getSimpleCommandArgument(String cmdline)
Copyright © 2025. All rights reserved.