PatternOptionBuilder
Date: 2017-04-22

org.apache.commons.cli

## Class PatternOptionBuilder

- java.lang.Object
- - org.apache.commons.cli.PatternOptionBuilder

-     public class PatternOptionBuilder
      extends java.lang.Object

  Allows Options to be created from a single String. The pattern contains various single character flags and via an optional punctuation character, their expected type.

  Overview of PatternOptionBuilder patterns
  a | -a flag
  b@ | -b [classname]
  c> | -c [filename]
  d+ | -d [classname] (creates object via empty constructor)
  e% | -e [number] (creates Double/Long instance depending on existing of a '.')
  f/ | -f [url]
  g: | -g [string]

  For example, the following allows command line flags of '-v -p string-value -f /dir/file'. The exclamation mark precede a mandatory option.

           Options options = PatternOptionBuilder.parsePattern("vp:!f/");

  TODO: These need to break out to OptionType and also to be pluggable.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.Class<?>` | `CLASS_VALUE` Class class
    `static java.lang.Class<java.util.Date>` | `DATE_VALUE` Date class
    `static java.lang.Class<java.io.FileInputStream>` | `EXISTING_FILE_VALUE` FileInputStream class
    `static java.lang.Class<java.io.File>` | `FILE_VALUE` File class
    `static java.lang.Class<java.io.File[]>` | `FILES_VALUE` File array class
    `static java.lang.Class<java.lang.Number>` | `NUMBER_VALUE` Number class
    `static java.lang.Class<java.lang.Object>` | `OBJECT_VALUE` Object class
    `static java.lang.Class<java.lang.String>` | `STRING_VALUE` String class
    `static java.lang.Class<java.net.URL>` | `URL_VALUE` URL class

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PatternOptionBuilder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.Object` | `getValueClass(char ch)` Retrieve the class that `ch` represents.
    `static boolean` | `isValueCode(char ch)` Returns whether `ch` is a value code, i.e.
    `static Options` | `parsePattern(java.lang.String pattern)` Returns the `Options` instance represented by `pattern`.

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### STRING_VALUE

          public static final java.lang.Class<java.lang.String> STRING_VALUE

      String class

    - #### OBJECT_VALUE

          public static final java.lang.Class<java.lang.Object> OBJECT_VALUE

      Object class

    - #### NUMBER_VALUE

          public static final java.lang.Class<java.lang.Number> NUMBER_VALUE

      Number class

    - #### DATE_VALUE

          public static final java.lang.Class<java.util.Date> DATE_VALUE

      Date class

    - #### CLASS_VALUE

          public static final java.lang.Class<?> CLASS_VALUE

      Class class

    - #### EXISTING_FILE_VALUE

          public static final java.lang.Class<java.io.FileInputStream> EXISTING_FILE_VALUE

      FileInputStream class

    - #### FILE_VALUE

          public static final java.lang.Class<java.io.File> FILE_VALUE

      File class

    - #### FILES_VALUE

          public static final java.lang.Class<java.io.File[]> FILES_VALUE

      File array class

    - #### URL_VALUE

          public static final java.lang.Class<java.net.URL> URL_VALUE

      URL class

  - ### Constructor Detail

    - #### PatternOptionBuilder

          public PatternOptionBuilder()

  - ### Method Detail

    - #### getValueClass

          public static java.lang.Object getValueClass(char ch)

      Retrieve the class that `ch` represents.
      Parameters:
        `ch` - the specified character
      Returns:
        The class that `ch` represents

    - #### isValueCode

          public static boolean isValueCode(char ch)

      Returns whether `ch` is a value code, i.e. whether it represents a class in a pattern.
      Parameters:
        `ch` - the specified character
      Returns:
        true if `ch` is a value code, otherwise false.

    - #### parsePattern

          public static Options parsePattern(java.lang.String pattern)

      Returns the `Options` instance represented by `pattern`.
      Parameters:
        `pattern` - the pattern string
      Returns:
        The `Options` instance