Class TextStyle.Builder

java.lang.Object
org.apache.commons.cli.help.TextStyle.Builder
All Implemented Interfaces:
Supplier<TextStyle>
Enclosing class:
TextStyle

public static final class TextStyle.Builder extends Object implements Supplier<TextStyle>
The builder for the TextStyle. The default values are:
  • alignment = LEFT
  • leftPad = 0
  • scaling = VARIABLE
  • minWidth = 0
  • maxWidth = UNSET_MAX_WIDTH
  • Field Details

    • alignment

      private TextStyle.Alignment alignment
      The alignment.
    • leftPad

      private int leftPad
      The left padding.
    • indent

      private int indent
      The subsequent line indentation.
    • scalable

      private boolean scalable
      The scalable flag. Identifies text blocks that can be made narrower or wider as needed by the HelpAppendable.
    • minWidth

      private int minWidth
      The minimum width.
    • maxWidth

      private int maxWidth
      The maximum width.
  • Constructor Details

    • Builder

      private Builder()
      Constructs a new instance. The default values are:
      • alignment = LEFT
      • leftPad = 0
      • scaling = VARIABLE
      • minWidth = 0
      • maxWidth = UNSET_MAX_WIDTH
  • Method Details

    • get

      public TextStyle get()
      Specified by:
      get in interface Supplier<TextStyle>
    • getIndent

      public int getIndent()
      Gets the currently specified indent value.
      Returns:
      The currently specified indent value.
    • getLeftPad

      public int getLeftPad()
      Gets the currently specified leftPad.
      Returns:
      The currently specified leftPad.
    • getMaxWidth

      public int getMaxWidth()
      Gets the currently specified maximum width value.
      Returns:
      The currently specified maximum width value.
    • getMinWidth

      public int getMinWidth()
      Gets the currently specified minimum width value.
      Returns:
      The currently specified minimum width value.
    • isScalable

      public boolean isScalable()
      Specifies if the column can be made wider or to narrower width to fit constraints of the HelpAppendable and formatting.
      Returns:
      The currently specified scaling value.
    • setAlignment

      public TextStyle.Builder setAlignment(TextStyle.Alignment alignment)
      Sets the alignment.
      Parameters:
      alignment - the desired alignment.
      Returns:
      this
    • setIndent

      public TextStyle.Builder setIndent(int indent)
      Sets the indent value.
      Parameters:
      indent - the new indent value.
      Returns:
      this
    • setLeftPad

      public TextStyle.Builder setLeftPad(int leftPad)
      Sets the left padding.
      Parameters:
      leftPad - the new left padding.
      Returns:
      this
    • setMaxWidth

      public TextStyle.Builder setMaxWidth(int maxWidth)
      Sets the currently specified minimum width.
      Parameters:
      maxWidth - The currently specified maximum width.
      Returns:
      this
    • setMinWidth

      public TextStyle.Builder setMinWidth(int minWidth)
      Sets the currently specified minimum width.
      Parameters:
      minWidth - The currently specified minimum width.
      Returns:
      this
    • setScalable

      public TextStyle.Builder setScalable(boolean scalable)
      Sets whether the column can be made wider or to narrower width to fit constraints of the HelpAppendable and formatting.
      Parameters:
      scalable - Whether the text width can be adjusted.
      Returns:
      this instance.
    • setTextStyle

      public TextStyle.Builder setTextStyle(TextStyle style)
      Sets all properties from the given text style.
      Parameters:
      style - the source text style.
      Returns:
      this instance.