Package org.apache.commons.cli.help

# Class AbstractHelpFormatter.Builder<B extends AbstractHelpFormatter.Builder<B,T>,T extends AbstractHelpFormatter>

java.lang.Object
org.apache.commons.cli.help.AbstractHelpFormatter.Builder<B,T>

Type Parameters:
  `B` - The builder type.
  `T` - The type to build.

All Implemented Interfaces:
  `Supplier<T>`

Direct Known Subclasses:
  `HelpFormatter.Builder`

Enclosing class:
  `AbstractHelpFormatter`

public abstract static class AbstractHelpFormatter.Builder<B extends AbstractHelpFormatter.Builder<B,T>,T extends AbstractHelpFormatter> extends Object implements Supplier<T>
Abstracts building instances for subclasses.

- helpAppendable = a `TextHelpAppendable` writing to `System.out`
- optionFormatter.Builder = the default `OptionFormatter.Builder`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `Builder()`
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected B`
  `asThis()`
  Returns this instance cast to `B`.
  `protected Comparator<Option>`
  `getComparator()`
  Gets the comparator to sort lists of options.
  `protected HelpAppendable`
  `getHelpAppendable()`
  Gets `HelpAppendable`.
  `protected OptionFormatter.Builder`
  `getOptionFormatBuilder()`
  Gets `OptionFormatter.Builder` to use to format options in the table.
  `protected String`
  `getOptionGroupSeparator()`
  Gets string to separate option groups.
  `B`
  `setComparator(Comparator<Option> comparator)`
  Sets the comparator to use for sorting options.
  `B`
  `setHelpAppendable(HelpAppendable helpAppendable)`
  Sets the `HelpAppendable`.
  `B`
  `setOptionFormatBuilder(OptionFormatter.Builder optionFormatBuilder)`
  Sets the `OptionFormatter.Builder`.
  `B`
  `setOptionGroupSeparator(String optionGroupSeparator)`
  Sets the OptionGroup separator.

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

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

  ### Methods inherited from interface java.util.function.Supplier

  `get`

- ## Constructor Details

  - ### Builder

    protected Builder()
    Constructs a new instance.

    Sets `showSince` to `true`.

- ## Method Details

  - ### asThis

    protected B asThis()
    Returns this instance cast to `B`.
    Returns:
      this instance cast to `B`.

  - ### getComparator

    protected Comparator<Option> getComparator()
    Gets the comparator to sort lists of options.
    Returns:
      the comparator to sort lists of options.

  - ### getHelpAppendable

    protected HelpAppendable getHelpAppendable()
    Gets `HelpAppendable`.
    Returns:
      the `HelpAppendable`.

  - ### getOptionFormatBuilder

    protected OptionFormatter.Builder getOptionFormatBuilder()
    Gets `OptionFormatter.Builder` to use to format options in the table.
    Returns:
      the `OptionFormatter.Builder` to use to format options in the table.

  - ### getOptionGroupSeparator

    protected String getOptionGroupSeparator()
    Gets string to separate option groups.
    Returns:
      the string to separate option groups.

  - ### setComparator

    public B setComparator(Comparator<Option> comparator)
    Sets the comparator to use for sorting options. If set to `null` no sorting is performed.
    Parameters:
      `comparator` - The comparator to use for sorting options.
    Returns:
      this

  - ### setHelpAppendable

    public B setHelpAppendable(HelpAppendable helpAppendable)
    Sets the `HelpAppendable`.
    Parameters:
      `helpAppendable` - the `HelpAppendable` to use.
    Returns:
      this

  - ### setOptionFormatBuilder

    public B setOptionFormatBuilder(OptionFormatter.Builder optionFormatBuilder)
    Sets the `OptionFormatter.Builder`.
    Parameters:
      `optionFormatBuilder` - the `OptionFormatter.Builder` to use.
    Returns:
      this

  - ### setOptionGroupSeparator

    public B setOptionGroupSeparator(String optionGroupSeparator)
    Sets the OptionGroup separator. Normally " | " or something similar to denote that only one option may be chosen.
    Parameters:
      `optionGroupSeparator` - the string to separate option group elements with.
    Returns:
      this