Skip to content

Package io.github.qishr.cascara.common.util

Class Builder

java.lang.Object
        io.github.qishr.cascara.common.util.CommandLine.Model.ArgSpec.Builder<io.github.qishr.cascara.common.util.CommandLine.Model.OptionSpec.Builder>
                io.github.qishr.cascara.common.util.CommandLine.Model.OptionSpec.Builder

Enclosing Class:
    io.github.qishr.cascara.common.util.CommandLine.Model.OptionSpec


public static class Builder
extends Builder<Builder>

Builder responsible for creating valid OptionSpec objects.

Method Summary

Modifier and Type Method Description
public OptionSpec build() Returns a valid OptionSpec instance.
protected Builder self() Returns this builder.
public String[] names() Returns one or more option names.
public boolean help() Returns whether this option disables validation of the other arguments.
public boolean usageHelp() Returns whether this option allows the user to request usage help.
public boolean versionHelp() Returns whether this option allows the user to request version information.
public boolean negatable() Returns whether a negative version for this boolean option is automatically added.
public String fallbackValue() Returns the fallback value for this option: the value that is assigned for options with an optional parameter if the option was specified on the command line without parameter.
public int order() Returns the position in the options list in the usage help message at which this option should be shown.
public Builder names(String[] names) Replaces the option names with the specified values.
public Builder help(boolean help) Sets whether this option disables validation of the other arguments, and returns this builder.
public Builder usageHelp(boolean usageHelp) Sets whether this option allows the user to request usage help, and returns this builder.
public Builder versionHelp(boolean versionHelp) Sets whether this option allows the user to request version information, and returns this builder.
public Builder negatable(boolean negatable) Sets whether a negative version for this boolean option is automatically added, and returns this builder.
public Builder fallbackValue(String fallbackValue) Sets the fallback value for this option: the value that is assigned for options with an optional parameter if the option was specified on the command line without parameter, and returns this builder.
public Builder order(int order) Sets the position in the options list in the usage help message at which this option should be shown, and returns this builder.

Method Details

build

public OptionSpec build()

Returns a valid OptionSpec instance.


self

protected Builder self()

Returns this builder.


names

public String[] names()

Returns one or more option names.At least one option name is required.

See Also:

names


help

public boolean help()

Returns whether this option disables validation of the other arguments.

Deprecation

Use usageHelp.usageHelp and versionHelp.versionHelp instead.

See Also:

help


usageHelp

public boolean usageHelp()

Returns whether this option allows the user to request usage help.

See Also:

usageHelp


versionHelp

public boolean versionHelp()

Returns whether this option allows the user to request version information.

See Also:

versionHelp


negatable

public boolean negatable()

Returns whether a negative version for this boolean option is automatically added.The form of the negative name is determined by the INegatableOptionTransformer.

Since:

4.0

See Also:

negatable


fallbackValue

public String fallbackValue()

Returns the fallback value for this option: the value that is assigned for options with an optional parameter if the option was specified on the command line without parameter.

Since:

4.0

See Also:

fallbackValue


order

public int order()

Returns the position in the options list in the usage help message at which this option should be shown.Options with a lower number are shown before options with a higher number. This attribute is only honored if UsageMessageSpec#sortOptions() is false for this command.

Since:

3.9

See Also:

order


names

public Builder names(String[] names)

Replaces the option names with the specified values.At least one option name is required, and returns this builder.

Returns:

this builder instance to provide a fluent interface


help

public Builder help(boolean help)

Sets whether this option disables validation of the other arguments, and returns this builder.


usageHelp

public Builder usageHelp(boolean usageHelp)

Sets whether this option allows the user to request usage help, and returns this builder.


versionHelp

public Builder versionHelp(boolean versionHelp)

Sets whether this option allows the user to request version information, and returns this builder.


negatable

public Builder negatable(boolean negatable)

Sets whether a negative version for this boolean option is automatically added, and returns this builder.

Since:

4.0


fallbackValue

public Builder fallbackValue(String fallbackValue)

Sets the fallback value for this option: the value that is assigned for options with an optional parameter if the option was specified on the command line without parameter, and returns this builder.

Since:

4.0

See Also:

fallbackValue


order

public Builder order(int order)

Sets the position in the options list in the usage help message at which this option should be shown, and returns this builder.

Since:

3.9