Module info.picocli
Package picocli

Class CommandLine.RegexTransformer.Builder

  • Enclosing class:
    CommandLine.RegexTransformer

    public static class CommandLine.RegexTransformer.Builder
    extends Object
    Builder for creating RegexTransformer objects.
    Since:
    4.0
    • Constructor Detail

      • Builder

        public Builder()
        Constructs an empty builder.
      • Builder

        public Builder​(CommandLine.RegexTransformer old)
        Constructs a builder populated with the values from the specified RegexTransformer.
    • Method Detail

      • addPattern

        public CommandLine.RegexTransformer.Builder addPattern​(String regex,
                                                               String negativeReplacement,
                                                               String synopsisReplacement)
        Adds the specified negative replacement and synopsis replacement for the specified regular expression. For example, to add negative forms for short options:
        Regular expressions for adding negative forms for short options
        Regex Negative Replacement Synopsis Replacement Comment
        ^-(\w)$ +$1 (+|-)$1 Converts -v to +v
        ^\+(\w)$ -$1 (+|-)$1 Converts -v to +v
        Parameters:
        regex - regular expression to match an option name
        negativeReplacement - the replacement to use to generate a negative name when the option name matches
        synopsisReplacement - the replacement to use to generate a documentation string when the option name matches
        Returns:
        this RegexTransformer for method chaining
      • removePattern

        public CommandLine.RegexTransformer.Builder removePattern​(String regex)
        Removes the negative replacement and synopsis replacement for the specified regular expression.
        Parameters:
        regex - regular expression to remove
        Returns:
        this RegexTransformer for method chaining