Class OptionFormatter.Builder

    • Constructor Detail

      • 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 Detail

      • 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.
      • setArgumentNameDelimiters

        public OptionFormatter.Builder setArgumentNameDelimiters​(java.lang.String begin,
                                                                 java.lang.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​(java.lang.String name)
        Sets the default argument name.
        Parameters:
        name - the new value of default argument name.
        Returns:
        this
      • setDeprecatedFormatFunction

        public OptionFormatter.Builder setDeprecatedFormatFunction​(java.util.function.Function<Option,​java.lang.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.
      • setOptArgSeparator

        public OptionFormatter.Builder setOptArgSeparator​(java.lang.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​(java.lang.String begin,
                                                             java.lang.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​(java.lang.String optPrefix)
        Specifies the short option prefix.
        Parameters:
        optPrefix - the prefix for short options.
        Returns:
        this instance.
      • setOptSeparator

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

        public java.lang.String toArgName​(java.lang.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.