Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.ifs.utils.common
Class CommandlineArguments

    java.lang.Object
      oracle.ifs.utils.common.CommandlineArguments

All Implemented Interfaces:
  java.io.Serializable

    public final class CommandlineArguments

extends java.lang.Object
implements java.io.Serializable

Commandline argument parser utility ---

See Also:
  Serialized Form
(Published)

Field Summary
`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 Summary
`CommandlineArguments(java.lang.String commandline)` Constructs an CommandlineArguments, with no flags.
`CommandlineArguments(java.lang.String[] args)` Constructs an CommandlineArguments, with no flags.
`CommandlineArguments(java.lang.String[] flags, boolean[] canHaveArgs, java.lang.String commandline)` Constructs an CommandlineArguments, with specifications as to the legal flags.
`CommandlineArguments(java.lang.String[] flags, boolean[] canHaveArgs, java.lang.String[] args)` Constructs an CommandlineArguments, with specifications as to the legal flags.
`CommandlineArguments(java.lang.String[] flags, int[] flagDescriptors, java.lang.String commandline)` Constructs an CommandlineArguments, with specifications as to the legal flags.
`CommandlineArguments(java.lang.String[] flags, int[] flagDescriptors, java.lang.String[] args)` Constructs an CommandlineArguments, with specifications as to the legal flags.

Method Summary
`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.
`java.lang.String` | `getPositionalArgumentValue(int index)` Returns a specific positional argument value as a String, from the parsed commandline.
`java.lang.String[]` | `getPositionalArgumentValues()` Returns the set of positional arguments values as Strings from the parsed commandline.
`static java.lang.String` | `getSimpleCommandArgument(java.lang.String cmdline)` return the substring after the first token of a commandline.
`static java.lang.String` | `getSimpleCommandToken(java.lang.String cmdline)` return first token of a commandline.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### FLAG_TYPE_NOARGS

    public static final int FLAG_TYPE_NOARGS

  Description copied from class: `CommandlineArguments`
  flag type enum, to indicate that the flag doesn't take any arguments.

  See Also:
    Constant Field Values
  (Published)

### FLAG_TYPE_SINGLEARG

    public static final int FLAG_TYPE_SINGLEARG

  Description copied from class: `CommandlineArguments`
  flag type enum, to indicate that the flag is followed by a single argument.

  See Also:
    Constant Field Values
  (Published)

### FLAG_TYPE_MULTIPLEARGS

    public static final int FLAG_TYPE_MULTIPLEARGS

  Description copied from class: `CommandlineArguments`
  flag type enum, to indicate that the flag is followed by potentially multiple arguments.

  See Also:
    Constant Field Values
  (Published)

### FLAG_TYPE_RESTOFARGS

    public static final int FLAG_TYPE_RESTOFARGS

  Description copied from class: `CommandlineArguments`
  flag type enum, to indicate that the rest of the commandline is the arg for this flag.

  See Also:
    Constant Field Values
  (Published)

Constructor Detail

### CommandlineArguments

    public CommandlineArguments(java.lang.String[] flags,
                                boolean[] canHaveArgs,
                                java.lang.String[] args)

  Constructs an CommandlineArguments, with specifications as to the legal flags.

  Parameters:
    `flags` - the list of valid flags
    `canHaveArgs` - indication as to whether the flags support an argument
    `args` - the set of commandline args to convert
  Throws:
    `if` - invalid args are specified
  (Published)

### CommandlineArguments

    public CommandlineArguments(java.lang.String[] flags,
                                boolean[] canHaveArgs,
                                java.lang.String commandline)

  Constructs an CommandlineArguments, with specifications as to the legal flags. Uses a single string as the commandline argument, which needs to be tokenized into discrete arguments.

  Parameters:
    `flags` - the list of valid flags
    `canHaveArgs` - indication as to whether the flags support an argument
    `commandline` - untokenized commandline
  Throws:
    `if` - invalid args are specified
  (Published)

### CommandlineArguments

    public CommandlineArguments(java.lang.String[] flags,
                                int[] flagDescriptors,
                                java.lang.String[] args)

  Constructs an CommandlineArguments, with specifications as to the legal flags.

  Parameters:
    `flags` - the list of valid flags
    `flagDescriptors` - description of the flags
    `args` - the set of commandline args to convert
  Throws:
    `if` - invalid args are specified
  (Published)

### CommandlineArguments

    public CommandlineArguments(java.lang.String[] flags,
                                int[] flagDescriptors,
                                java.lang.String commandline)

  Constructs an CommandlineArguments, with specifications as to the legal flags. Uses a single string as the commandline argument, which needs to be tokenized into discrete arguments.

  Parameters:
    `flags` - the list of valid flags
    `flagDescriptors` - description of the flags
    `commandline` - untokenized commandline
  Throws:
    `if` - invalid args are specified
  (Published)

### CommandlineArguments

    public CommandlineArguments(java.lang.String[] args)

  Constructs an CommandlineArguments, with no flags.

  Parameters:
    `args` - the set of commandline args to convert
  Throws:
    `if` - invalid args are specified
  (Published)

### CommandlineArguments

    public CommandlineArguments(java.lang.String commandline)

  Constructs an CommandlineArguments, with no flags. Uses a single string as the commandline argument, which needs to be tokenized into discrete arguments.

  Parameters:
    `commandline` - untokenized commandline
  Throws:
    `if` - invalid args are specified
  (Published)

Method Detail

### getPositionalArguments

    public Argument[] getPositionalArguments()

  Description copied from class: `CommandlineArguments`
  Returns the set of positional arguments from the parsed commandline.

  Returns:
    array of positional Argument objects
  Throws:
    `if` - invalid args are specified
  (Published)

### getPositionalArgumentsCount

    public int getPositionalArgumentsCount()

  Description copied from class: `CommandlineArguments`
  Returns the count of positional arguments from the parsed commandline.

  Returns:
    count of positional Argument objects
  Throws:
    `if` - invalid args are specified
  (Published)

### getPositionalArgumentValue

    public java.lang.String getPositionalArgumentValue(int index)

  Description copied from class: `CommandlineArguments`
  Returns a specific positional argument value as a String, from the parsed commandline.

  Parameters:
    `index` - The requested positional argument.
  Returns:
    array of positional Strings.
  Throws:
    `if` - invalid args are specified
  (Published)

### getPositionalArgumentValues

    public java.lang.String[] getPositionalArgumentValues()

  Description copied from class: `CommandlineArguments`
  Returns the set of positional arguments values as Strings from the parsed commandline.

  Returns:
    array of positional Strings.
  Throws:
    `if` - invalid args are specified
  (Published)

### getFlaggedArguments

    public Argument[] getFlaggedArguments()

  Description copied from class: `CommandlineArguments`
  Returns the set of flagged arguments from the parsed commandline.

  Returns:
    array of flagged Argument objects
  Throws:
    `if` - invalid args are specified
  (Published)

### getFlaggedArgumentsCount

    public int getFlaggedArgumentsCount()

  Description copied from class: `CommandlineArguments`
  Returns the count of flagged arguments from the parsed commandline.

  Returns:
    array of flagged Argument objects
  Throws:
    `if` - invalid args are specified
  (Published)

### getSimpleCommandToken

    public static java.lang.String getSimpleCommandToken(java.lang.String cmdline)

  Description copied from class: `CommandlineArguments`
  return first token of a commandline. Assume space delimiter. For example, a string of "go Gators" would return the string "go".

  Returns:
    first token of a commandline
  (Published)

### getSimpleCommandArgument

    public static java.lang.String getSimpleCommandArgument(java.lang.String cmdline)

  Description copied from class: `CommandlineArguments`
  return the substring after the first token of a commandline. Assume space delimiter. Trim any leading spaces or trailing spaces. For example, a string of "go Gators " would return the string "Gators". Return null is the resultant substring would be empty.

  Returns:
    first token of a commandline
  (Published)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD