Package org.seedstack.seed.cli
Annotation Type CliOption
-
@Retention(RUNTIME) @Target({FIELD,ANNOTATION_TYPE}) public @interface CliOption
This annotation marks a field as an option of the commandline. Field can be of type:- boolean in which case the option must take no value and the field will be set to true if the option is present of false otherwise.
- String in which case the option must take at least one value and the field will be set to the first value of the option. If option is not present or has no value, the field will be set to null.
- String[] in which case the option must take zero or more values and the field will be set to an array containing all values of the option. If option is not present or has no value, the field will be set to null.
- Map<String, String> in which case the option must take an even number of values and the field will be set to a map containing odd option values as keys and even option values as values. If option is not present or has no value, the field will be set to an empty map.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description String[]defaultValuesThe default value(s) of the option.StringdescriptionThe description of the option (used by the help command).StringlongNameThe long name of the option.booleanmandatoryIf the option is mandatory.booleanmandatoryValueIf the option values are mandatory.intvalueCountThe number of values this option can take (or -1 if unlimited).charvalueSeparatorThe character for separating option values.
-
-
-
Element Detail
-
name
String name
The short name of the option.
-
-
-
longName
String longName
The long name of the option.- Default:
- ""
-
-
-
valueSeparator
char valueSeparator
The character for separating option values. It can be set to '=' to parse named option values. When providing -Okey1=value1 -Okey2=value2 on the command line, the result can then be injected into a String array containing key/value pairs ([ "key1", "value1", "key2", "value2"]) or directly into a Map<String, String>.- Default:
- ','
-
-
-
defaultValues
String[] defaultValues
The default value(s) of the option. Used when the option is not mandatory and not present in the command line. Also used when the option is present, its values are not mandatory and are not present in the command line.- Default:
- {}
-
-
-
description
String description
The description of the option (used by the help command).- Default:
- ""
-
-