Package org.apache.commons.cli
Class HelpFormatter.Builder
- java.lang.Object
-
- org.apache.commons.cli.HelpFormatter.Builder
-
- All Implemented Interfaces:
java.util.function.Supplier<HelpFormatter>
- Enclosing class:
- HelpFormatter
public static final class HelpFormatter.Builder extends java.lang.Object implements java.util.function.Supplier<HelpFormatter>
BuildsHelpFormatter
.- Since:
- 1.7.0
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.function.Function<Option,java.lang.String>
DEFAULT_DEPRECATED_FORMAT
A function to convert a description (not null) and a deprecated Option (not null) to help descriptionprivate java.util.function.Function<Option,java.lang.String>
deprecatedFormatFunc
Formatter for deprecated options.private java.io.PrintWriter
printStream
The output PrintWriter, defaults to wrappingSystem.out
.
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HelpFormatter
get()
HelpFormatter.Builder
setPrintWriter(java.io.PrintWriter printWriter)
Sets the output PrintWriter, defaults to wrappingSystem.out
.HelpFormatter.Builder
setShowDeprecated(boolean useDefaultFormat)
Sets whether to show deprecated options.HelpFormatter.Builder
setShowDeprecated(java.util.function.Function<Option,java.lang.String> showDeprecatedFunc)
Sets whether to show deprecated options.
-
-
-
Field Detail
-
DEFAULT_DEPRECATED_FORMAT
private static final java.util.function.Function<Option,java.lang.String> DEFAULT_DEPRECATED_FORMAT
A function to convert a description (not null) and a deprecated Option (not null) to help description
-
deprecatedFormatFunc
private java.util.function.Function<Option,java.lang.String> deprecatedFormatFunc
Formatter for deprecated options.
-
printStream
private java.io.PrintWriter printStream
The output PrintWriter, defaults to wrappingSystem.out
.
-
-
Method Detail
-
get
public HelpFormatter get()
- Specified by:
get
in interfacejava.util.function.Supplier<HelpFormatter>
-
setPrintWriter
public HelpFormatter.Builder setPrintWriter(java.io.PrintWriter printWriter)
Sets the output PrintWriter, defaults to wrappingSystem.out
.- Parameters:
printWriter
- the output PrintWriter, not null.- Returns:
- this.
-
setShowDeprecated
public HelpFormatter.Builder setShowDeprecated(boolean useDefaultFormat)
Sets whether to show deprecated options.- Parameters:
useDefaultFormat
- iftrue
use the default format, otherwise clear the formatter.- Returns:
- this.
-
setShowDeprecated
public HelpFormatter.Builder setShowDeprecated(java.util.function.Function<Option,java.lang.String> showDeprecatedFunc)
Sets whether to show deprecated options.- Parameters:
showDeprecatedFunc
- Specify the format for the deprecated options.- Returns:
- this.
- Since:
- 1.8.0
-
-