# Class GnuParser

java.lang.Object
org.apache.commons.cli.Parser
org.apache.commons.cli.GnuParser

All Implemented Interfaces:
  `CommandLineParser`

@Deprecated public class GnuParser extends Parser
Deprecated.
Since 1.3, use the `DefaultParser` instead.
The class GnuParser provides an implementation of the `flatten` method.

- ## Field Summary

  ### Fields inherited from class Parser

  `cmd`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GnuParser()`
  Deprecated.
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected String[]`
  `flatten(Options options, String[] arguments, boolean stopAtNonOption)`
  Deprecated.
  This flatten method does so using the following rules: If an `Option` exists for the first character of the `arguments` entry AND an `Option` does not exist for the whole `argument` then add the first character as an option to the processed tokens list for example "-D" and add the rest of the entry to the also. Otherwise just add the token to the processed tokens list.

  ### Methods inherited from class Parser

  `checkRequiredOptions, getOptions, getRequiredOptions, parse, parse, parse, parse, processArgs, processOption, processProperties, setOptions`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### GnuParser

    public GnuParser()
    Deprecated.
    Constructs a new instance.

- ## Method Details

  - ### flatten

    protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption)
    Deprecated.
    This flatten method does so using the following rules:
    1. If an `Option` exists for the first character of the `arguments` entry AND an `Option` does not exist for the whole `argument` then add the first character as an option to the processed tokens list for example "-D" and add the rest of the entry to the also.
    2. Otherwise just add the token to the processed tokens list.
    Specified by:
      `flatten` in class `Parser`
    Parameters:
      `options` - The Options to parse the arguments by.
      `arguments` - The arguments that have to be flattened.
      `stopAtNonOption` - specifies whether to stop flattening when a non option has been encountered.
    Returns:
      a String array of the flattened arguments.