Class Args.Builder
java.lang.Object
org.apache.juneau.commons.runtime.Args.Builder
- Enclosing class:
- Args
Builder for
Args with configurable grammar hooks.
Defaults match the legacy -key value [value...] parsing plus the natural extensions
(
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallowEquals(boolean value) Enables or disables recognition of the--key=value /-key=value form.allowLongFlags(boolean value) Enables or disables recognition of long-flag prefix-- .allowShortFlags(boolean value) Enables or disables recognition of short-flag prefix- .allowSystemPropStyle(boolean value) Enables or disables Java system-property style-Dkey=value parsing (strips the leadingD).Parses the given command-line string into anArgsinstance.Parses the given argv array into anArgsinstance.caseSensitive(boolean value) Controls whether named-option lookups are case-sensitive.customPrefix(String... prefixes) Overrides the default flag prefixes ("-"and"--").
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
allowEquals
Enables or disables recognition of the--key=value /-key=value form.- Parameters:
value-true to recognize the equals form. Defaulttrue .- Returns:
- This object.
-
allowShortFlags
Enables or disables recognition of short-flag prefix- .- Parameters:
value-true to recognize-key -style flags. Defaulttrue .- Returns:
- This object.
-
allowLongFlags
Enables or disables recognition of long-flag prefix-- .- Parameters:
value-true to recognize--key -style flags. Defaulttrue .- Returns:
- This object.
-
allowSystemPropStyle
Enables or disables Java system-property style-Dkey=value parsing (strips the leadingD).- Parameters:
value-true to recognize-Dkey=value . Defaulttrue .- Returns:
- This object.
-
caseSensitive
Controls whether named-option lookups are case-sensitive.- Parameters:
value-true for case-sensitive lookups. Defaulttrue .- Returns:
- This object.
-
customPrefix
Overrides the default flag prefixes ("-"and"--").Pass an empty array to disable flag parsing entirely (every token becomes positional). When set, this supersedes
allowShortFlags(boolean)andallowLongFlags(boolean).- Parameters:
prefixes- The replacement prefix list, ornull to keep the default behavior.- Returns:
- This object.
-
build
Parses the given command-line string into anArgsinstance.- Parameters:
line- The raw command line. Can benull (treated as an empty argv).- Returns:
- A new immutable
Argsinstance.
-
build
Parses the given argv array into anArgsinstance.- Parameters:
argv- The arguments. Can benull (treated as an empty argv).- Returns:
- A new immutable
Argsinstance.
-