# Class OptionFormatter.Builder

java.lang.Object
org.apache.commons.cli.help.OptionFormatter.Builder

All Implemented Interfaces:
  `Supplier<OptionFormatter>`

Enclosing class:
  `OptionFormatter`

public static final class OptionFormatter.Builder extends Object implements Supplier<OptionFormatter>
Builds instances of `OptionFormatter`.

Since:
  1.10.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Builder(OptionFormatter optionFormatter)`
  Constructor that takes the arguments from the supplied `OptionFormatter`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `OptionFormatter`
  `build(Option option)`
  Build an OptionFormatter to format the specified option.
  `OptionFormatter`
  `get()`
  `OptionFormatter.Builder`
  `setArgumentNameDelimiters(String begin, String end)`
  Specifies the starting and ending argument name delimiters for `Option` instances.
  `OptionFormatter.Builder`
  `setDefaultArgName(String name)`
  Sets the default argument name.
  `OptionFormatter.Builder`
  `setDeprecatedFormatFunction(Function<Option,String> deprecatedFormatFunction)`
  Specifies the function to construct the deprecated massage for the Option.
  `OptionFormatter.Builder`
  `setLongOptPrefix(String prefix)`
  Sets the long option prefix.
  `OptionFormatter.Builder`
  `setOptArgSeparator(String optArgSeparator)`
  Sets the separator displayed between a options and the argument name.
  `OptionFormatter.Builder`
  `setOptionalDelimiters(String begin, String end)`
  Specifies the starting and ending delimiters for optional `Option` instances.
  `OptionFormatter.Builder`
  `setOptPrefix(String optPrefix)`
  Specifies the short option prefix.
  `OptionFormatter.Builder`
  `setOptSeparator(String optSeparator)`
  Sets the separator displayed between a long option and short options.
  `OptionFormatter.Builder`
  `setSyntaxFormatFunction(BiFunction<OptionFormatter, Boolean, String> syntaxFormatFunction)`
  Specifies the function to convert an `OptionFormatter` into the syntax format for the option.
  `String`
  `toArgName(String argName)`
  A helper method to format any string as an argument name based on this builder.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### Builder

    public Builder(OptionFormatter optionFormatter)
    Constructor that takes the arguments from the supplied `OptionFormatter`
    Parameters:
      `optionFormatter` - The option formatter to provide values for the builder.

- ## Method Details

  - ### build

    public OptionFormatter build(Option option)
    Build an OptionFormatter to format the specified option.
    Parameters:
      `option` - The Option to format.
    Returns:
      An OptionFormatter to format the specified option.

  - ### get

    public OptionFormatter get()
    Specified by:
      `get` in interface `Supplier<OptionFormatter>`

  - ### setArgumentNameDelimiters

    public OptionFormatter.Builder setArgumentNameDelimiters(String begin, String end)
    Specifies the starting and ending argument name delimiters for `Option` instances.
    Parameters:
      `begin` - the beginning delimiter.
      `end` - the ending delimiter.
    Returns:
      `this` instance.

  - ### setDefaultArgName

    public OptionFormatter.Builder setDefaultArgName(String name)
    Sets the default argument name.
    Parameters:
      `name` - the new value of default argument name.
    Returns:
      this

  - ### setDeprecatedFormatFunction

    public OptionFormatter.Builder setDeprecatedFormatFunction(Function<Option,String> deprecatedFormatFunction)
    Specifies the function to construct the deprecated massage for the Option. Should include the description text if desired.
    Parameters:
      `deprecatedFormatFunction` - the function to specify the deprecated message for the option.
    Returns:
      `this` instance.

  - ### setLongOptPrefix

    public OptionFormatter.Builder setLongOptPrefix(String prefix)
    Sets the long option prefix.
    Parameters:
      `prefix` - prefix for long options.
    Returns:
      this

  - ### setOptArgSeparator

    public OptionFormatter.Builder setOptArgSeparator(String optArgSeparator)
    Sets the separator displayed between a options and the argument name. Typically ' ' or '='.
    Parameters:
      `optArgSeparator` - the separator.
    Returns:
      this
    Since:
      1.3

  - ### setOptionalDelimiters

    public OptionFormatter.Builder setOptionalDelimiters(String begin, String end)
    Specifies the starting and ending delimiters for optional `Option` instances.
    Parameters:
      `begin` - the beginning delimiter.
      `end` - the ending delimiter.
    Returns:
      `this` instance.

  - ### setOptPrefix

    public OptionFormatter.Builder setOptPrefix(String optPrefix)
    Specifies the short option prefix.
    Parameters:
      `optPrefix` - the prefix for short options.
    Returns:
      `this` instance.

  - ### setOptSeparator

    public OptionFormatter.Builder setOptSeparator(String optSeparator)
    Sets the separator displayed between a long option and short options. Typically ',' or ' '.
    Parameters:
      `optSeparator` - the separator.
    Returns:
      this
    Since:
      1.3

  - ### setSyntaxFormatFunction

    public OptionFormatter.Builder setSyntaxFormatFunction(BiFunction<OptionFormatter, Boolean, String> syntaxFormatFunction)
    Specifies the function to convert an `OptionFormatter` into the syntax format for the option.
    Parameters:
      `syntaxFormatFunction` - The function to convert an `OptionFormatter` into the syntax format for the option.
    Returns:
      this

  - ### toArgName

    public String toArgName(String argName)
    A helper method to format any string as an argument name based on this builder.
    Parameters:
      `argName` - the name of the argument.
    Returns:
      the formatted argument.