Top Description Fields Constructors Methods
org.kohsuke.args4j

public Class ParserProperties

extends Object
Class Inheritance
Imports
org.kohsuke.args4j.spi.OptionHandler, java.util.Comparator

Set of properties that controls CmdLineParser behaviours.
See Also
CmdLineParser#CmdLineParser(Object, ParserProperties)

Field Summary

Modifier and TypeField and Description
private boolean
pack-priv static final Comparator<OptionHandler<T>>
private static final int
private Comparator<OptionHandler<T>>
private String
private boolean
private int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ParserProperties
defaults()

Returns an instance of the default parser properties.

public boolean
getAtSyntax()

Gets whether @-prefix-parsing is enabled.

pack-priv Comparator<OptionHandler<T>>

Returns:

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.
getOptionSorter
()

public String
public boolean
getShowDefaults()

Gets whether show defaults is enabled.

pack-priv int

Returns:

the width of a usage line.
getUsageWidth
()

public ParserProperties
withAtSyntax(boolean
true if at sign is being parsed, false if it is to be ignored. Defaults to true.
atSyntax
)

Toggles the parsing of @-prefixes in values.

public ParserProperties
withOptionSorter(Comparator<OptionHandler<T>>
If non-null, options are sorted in the order induced by this comparator.
sorter
)

Controls how options are sorted in the usage screen.

public ParserProperties
withOptionValueDelimiter(String v)

Sets the string used to separate option name and its value (such as --foo=bar vs --foo bar) Default to whitespace.

public ParserProperties
withShowDefaults(boolean
true if to show defaults, false otherweise. Defaults to true.
showDefaults
)

Toggles the showing of default values in the command line help.

public ParserProperties
withUsageWidth(int
the width of the usage output in columns.
usageWidth
)

Sets the width of a usage line.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

atSyntaxback to summary
private boolean atSyntax
DEFAULT_COMPARATORback to summary
pack-priv static final Comparator<OptionHandler<T>> DEFAULT_COMPARATOR
DEFAULT_USAGE_WIDTHback to summary
private static final int DEFAULT_USAGE_WIDTH
optionSorterback to summary
private Comparator<OptionHandler<T>> optionSorter
optionValueDelimiterback to summary
private String optionValueDelimiter
showDefaultsback to summary
private boolean showDefaults
usageWidthback to summary
private int usageWidth

Constructor Detail

ParserPropertiesback to summary
private ParserProperties()

Method Detail

defaultsback to summary
public static ParserProperties defaults()

Returns an instance of the default parser properties. This instance can be manipulated with the withXXX() methods in this class.

getAtSyntaxback to summary
public boolean getAtSyntax()

Gets whether @-prefix-parsing is enabled.

See Also
withAtSyntax(boolean)
getOptionSorterback to summary
pack-priv Comparator<OptionHandler<T>> getOptionSorter()
Returns:Comparator<OptionHandler<T>>

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.

getOptionValueDelimiterback to summary
public String getOptionValueDelimiter()
getShowDefaultsback to summary
public boolean getShowDefaults()

Gets whether show defaults is enabled.

See Also
withShowDefaults(boolean)
getUsageWidthback to summary
pack-priv int getUsageWidth()
Returns:int

the width of a usage line.

withAtSyntaxback to summary
public ParserProperties withAtSyntax(boolean atSyntax)

Toggles the parsing of @-prefixes in values. If a command line value starts with @, it is interpreted as being a file, loaded, and interpreted as if the file content would have been passed to the command line.

Parameters
atSyntax:boolean

true if at sign is being parsed, false if it is to be ignored. Defaults to true.

See Also
getAtSyntax()
withOptionSorterback to summary
public ParserProperties withOptionSorter(Comparator<OptionHandler<T>> sorter)

Controls how options are sorted in the usage screen.

Parameters
sorter:Comparator<OptionHandler<T>>

If non-null, options are sorted in the order induced by this comparator.

withOptionValueDelimiterback to summary
public ParserProperties withOptionValueDelimiter(String v)

Sets the string used to separate option name and its value (such as --foo=bar vs --foo bar) Default to whitespace. Note that the tokens separated in the argument array (such as '-foo','bar') is always recognized as a valid name/value separator.

withShowDefaultsback to summary
public ParserProperties withShowDefaults(boolean showDefaults)

Toggles the showing of default values in the command line help.

Parameters
showDefaults:boolean

true if to show defaults, false otherweise. Defaults to true.

See Also
getShowDefaults()
withUsageWidthback to summary
public ParserProperties withUsageWidth(int usageWidth)

Sets the width of a usage line. If the usage message is longer than this value, the parser wraps the line. Defaults to 80.

Parameters
usageWidth:int

the width of the usage output in columns.

Exceptions
IllegalArgumentException:
if usageWidth is negative