Skip to content

default values

h908714124 edited this page Jul 20, 2021 · 10 revisions

jbock doesn't have a way to specify default values. The only "default values" it knows are Optional.empty(), OptionalInt.empty(), OptionalLong.empty() and OptionalDouble.empty()1.

(update 5.2: added io.vavr.control.Option)

In particular, jbock will not use a null default, and any type that isn't one of the Optional variants mentioned above represents a required option or parameter. When a required option is missing, the generated parse method will return a Left, rather than a command instance with "missing" properties.

See JCommander for an example.

1Maybe boolean could be added to that list, considering how mode flags work.

Clone this wiki locally