public class LongOpt extends Object
Getopt| Modifier and Type | Field and Description |
|---|---|
protected StringBuilder | flagIf this variable is not null, then the value stored in "val" is stored
here when this long option is encountered. |
protected int | has_argIndicates whether the option has no argument, a required argument, or
an optional argument. |
protected String | nameThe name of the long option |
static int | NO_ARGUMENTConstant value used for the "has_arg" constructor argument. |
static int | OPTIONAL_ARGUMENTConstant value used for the "has_arg" constructor argument. |
static int | REQUIRED_ARGUMENTConstant value used for the "has_arg" constructor argument. |
protected int | valThe value to store in "flag" if flag is not null, otherwise the
equivalent short option character for this long option. |
| Constructor and Description |
|---|
LongOpt(String name,
int has_arg,
StringBuilder flag,
int val)Create a new LongOpt object with the given parameter values. |
| Modifier and Type | Method and Description |
|---|---|
StringBuilder | getFlag()Returns the value of the 'flag' field for this long option |
int | getHasArg()Returns the value set for the 'has_arg' field for this long option |
String | getName()Returns the name of this LongOpt as a String |
int | getVal()Returns the value of the 'val' field for this long option |
protected StringBuilder flag
protected int has_arg
protected String name
public static final int NO_ARGUMENT
public static final int OPTIONAL_ARGUMENT
public static final int REQUIRED_ARGUMENT
protected int val
public LongOpt(String name, int has_arg, StringBuilder flag, int val) throws IllegalArgumentException
name - The long option String.has_arg - Indicates whether the option has no argument (NO_ARGUMENT), a required argument (REQUIRED_ARGUMENT) or an optional argument (OPTIONAL_ARGUMENT).flag - If non-null, this is a location to store the value of "val" when this option is encountered, otherwise "val" is treated as the equivalent short option character.val - The value to return for this long option, or the equivalent single letter option to emulate if flag is null.IllegalArgumentException - If the has_arg param is not one of NO_ARGUMENT, REQUIRED_ARGUMENT or OPTIONAL_ARGUMENT.public StringBuilder getFlag()
public int getHasArg()
public String getName()
public int getVal()