Package picocli
Class CommandLine.RegexTransformer.Builder
- java.lang.Object
-
- picocli.CommandLine.RegexTransformer.Builder
-
- Enclosing class:
- CommandLine.RegexTransformer
public static class CommandLine.RegexTransformer.Builder extends Object
Builder for creatingRegexTransformer
objects.- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description Builder()
Constructs an empty builder.Builder(CommandLine.RegexTransformer old)
Constructs a builder populated with the values from the specified RegexTransformer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CommandLine.RegexTransformer.Builder
addPattern(String regex, String negativeReplacement, String synopsisReplacement)
Adds the specified negative replacement and synopsis replacement for the specified regular expression.CommandLine.RegexTransformer
build()
CommandLine.RegexTransformer.Builder
removePattern(String regex)
Removes the negative replacement and synopsis replacement for the specified regular expression.
-
-
-
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 namenegativeReplacement
- the replacement to use to generate a negative name when the option name matchessynopsisReplacement
- 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
-
build
public CommandLine.RegexTransformer build()
-
-