Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class OptionSpec

  1. Object
  2. ArgSpec
  3. OptionSpec
The model of one option, written by the build from an CommandLine.Option.

Constructors

public OptionSpec(int slot, String[] names, String description, String paramLabel, boolean flag, boolean required, String arity, boolean multiple, String defaultValue, String split, boolean negatable, boolean hidden)Creates the model of an option.

Methods

public String[] names()Every name of the option.
public String longestName()The longest name, which the usage line and error messages print.
public boolean negatable()Whether --no-<name> sets the flag to false.
public boolean usageHelp()Whether this is the built-in --help.
public boolean versionHelp()Whether this is the built-in --version.

Inherited methods

Constructor details

OptionSpec

public OptionSpec(int slot, String[] names, String description, String paramLabel, boolean flag, boolean required, String arity, boolean multiple, String defaultValue, String split, boolean negatable, boolean hidden)
Creates the model of an option.

Parameters

slot int
the number the generated binding knows this option by
names String[]
every name, such as -v and --verbose
description String
the help text
paramLabel String
the placeholder printed for its value, such as <file>
flag boolean
true for a boolean that takes no value
required boolean
whether a command line without it is an error
arity String
how many values one occurrence takes, as 1, 0..1 or 1..*; empty for the default
multiple boolean
true when the field is an array or a list
defaultValue String
the value used when the option is absent, or null; ${env:NAME} reads an environment variable
split String
a separator that splits one value into several, or null
negatable boolean
whether --no-<name> sets a flag to false
hidden boolean
whether it is left out of the help

Method details

names

public String[] names()
Every name of the option.

longestName

public String longestName()
The longest name, which the usage line and error messages print.

negatable

public boolean negatable()
Whether --no-<name> sets the flag to false.

usageHelp

public boolean usageHelp()
Whether this is the built-in --help.

versionHelp

public boolean versionHelp()
Whether this is the built-in --version.