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

@Retention(CLASS) @Target({FIELD})

public @interface CommandLine.Option

Marks a field that receives an option.

Methods

public abstract String[] names()The option’s names, such as -v and --verbose.
public abstract String[] description() default {}Help text.
public abstract boolean required() default falseWhether a command line without the option is an error.
public abstract String arity() default ""How many values one occurrence takes: 1, 0..1, 1..*.
public abstract String paramLabel() default ""The placeholder printed for the value.
public abstract String defaultValue() default ""The value used when the option is absent.
public abstract boolean negatable() default falseWhether --no-<name> sets a boolean to false.
public abstract String split() default ""A separator that splits one value into several, such as ,.
public abstract boolean hidden() default falseLeaves the option out of the help.
public abstract Class<?> converter() default voidA converter for a type the build does not convert by itself.

Method details

names

public abstract String[] names()
The option’s names, such as -v and --verbose.

description

public abstract String[] description() default {}
Help text.

required

public abstract boolean required() default false
Whether a command line without the option is an error.

arity

public abstract String arity() default ""
How many values one occurrence takes: 1, 0..1, 1..*.

paramLabel

public abstract String paramLabel() default ""
The placeholder printed for the value.

defaultValue

public abstract String defaultValue() default ""
The value used when the option is absent. ${env:NAME} reads an environment variable.

negatable

public abstract boolean negatable() default false
Whether --no-<name> sets a boolean to false.

split

public abstract String split() default ""
A separator that splits one value into several, such as ,.

hidden

public abstract boolean hidden() default false
Leaves the option out of the help.

converter

public abstract Class<?> converter() default void
A converter for a type the build does not convert by itself.