public class ParserProperties
extends java.lang.Object
CmdLineParser behaviours.| Modifier and Type | Field and Description |
|---|---|
private boolean |
atSyntax |
(package private) static java.util.Comparator<OptionHandler> |
DEFAULT_COMPARATOR |
private static int |
DEFAULT_USAGE_WIDTH |
private java.util.Comparator<OptionHandler> |
optionSorter |
private java.lang.String |
optionValueDelimiter |
private boolean |
showDefaults |
private int |
usageWidth |
| Modifier | Constructor and Description |
|---|---|
private |
ParserProperties() |
| Modifier and Type | Method and Description |
|---|---|
static ParserProperties |
defaults()
Returns an instance of the default parser properties.
|
boolean |
getAtSyntax()
Gets whether @-prefix-parsing is enabled.
|
(package private) java.util.Comparator<OptionHandler> |
getOptionSorter() |
java.lang.String |
getOptionValueDelimiter() |
boolean |
getShowDefaults()
Gets whether show defaults is enabled.
|
(package private) int |
getUsageWidth() |
ParserProperties |
withAtSyntax(boolean atSyntax)
Toggles the parsing of @-prefixes in values.
|
ParserProperties |
withOptionSorter(java.util.Comparator<OptionHandler> sorter)
Controls how options are sorted in the usage screen.
|
ParserProperties |
withOptionValueDelimiter(java.lang.String v)
Sets the string used to separate option name and its value (such as --foo=bar vs --foo bar)
Default to whitespace.
|
ParserProperties |
withShowDefaults(boolean showDefaults)
Toggles the showing of default values in the command line help.
|
ParserProperties |
withUsageWidth(int usageWidth)
Sets the width of a usage line.
|
private static final int DEFAULT_USAGE_WIDTH
private int usageWidth
private java.util.Comparator<OptionHandler> optionSorter
private java.lang.String optionValueDelimiter
private boolean atSyntax
private boolean showDefaults
static final java.util.Comparator<OptionHandler> DEFAULT_COMPARATOR
public static ParserProperties defaults()
withXXX() methods
in this class.public ParserProperties withAtSyntax(boolean atSyntax)
atSyntax - true if at sign is being parsed, false
if it is to be ignored. Defaults to true.getAtSyntax()public boolean getAtSyntax()
withAtSyntax(boolean)public ParserProperties withShowDefaults(boolean showDefaults)
showDefaults - true if to show defaults, false
otherweise. Defaults to true.getShowDefaults()public boolean getShowDefaults()
withShowDefaults(boolean)public ParserProperties withUsageWidth(int usageWidth)
80.usageWidth - the width of the usage output in columns.java.lang.IllegalArgumentException - if usageWidth is negativeint getUsageWidth()
public ParserProperties withOptionSorter(java.util.Comparator<OptionHandler> sorter)
sorter - If non-null, options are sorted in the order induced by this comparator.java.util.Comparator<OptionHandler> getOptionSorter()
null if options are left unsorted and should be listed by their discovery order.
Otherwise the returned comparator is used to sort options.
The default value is a comparator that sorts options alphabetically.public ParserProperties withOptionValueDelimiter(java.lang.String v)
public java.lang.String getOptionValueDelimiter()