@Option (name="jndi-name", symbol='j', required=true) private volatile String jndiName;Such an option is specified as either "--jndi-name = jdbc/mysql" or "--jndi-name jdbc/mysql or "-j=jdbc/mysql" or "-j jdbc/mysql" on the command line.
@Option (symbol='f', type=OptionType.BOOLEAN, defaultValue="false", legalValues={"true", "false"}) private volatile String force;OR:
@Option (symbol='f' defaultValue=false) private volatile boolean force; OR: @Option (symbol='f') private volatile boolean force = false;Such an option is specified as either "--force" or "-f" or "--no-force" or "--force=true" or "--force=false" on the command line. Not specifying it on the command line makes it assume its deault value specified by the value of the field (2nd case above) or the value of annotation field, defaultValue (1st case above).
@Option (type=OptionType.PASSWORD, required=true) private volatile String password;Such an option is treated specially by the command line. Note the following in this regard:
@Option (name="property" repeats=true/false, type=OptionType.PROPERTY) private final Map < String, String > properties;Such an option can be specified as: --property prop1=value1 --property prop2=value2 or --property=name1=value1 --property=name2=value2 on the command line depdending on the value of repeats. Note that the type PROPERTY is a special treatment for a commonly used pattern where command implementations need to process properties.
Any use of '=' in the property names and values needs to be escaped with a backslash.
@Option (name="connection-properties", repeats=false, type=OptionType.PROPERTIES) private final Map < String, String > properties;This can be specified as --connection-properties dbname=Oracle:url=jdbc\:localhost\:4456 which means there are two properties with names dbname and url and values Oracle and jdbc:localhost:4456 respectively.
@Option (name="file", type=OptionType.FILE) private volatile File f;This option is specified as --file foo.jar and results in a binary file upload from the client to the server. The file is uploaded in a specific area and that file is then injected into this variable.
@Operand (required=true) private volatile String server;
@Operand (required=true, type=OptionType.FILE) @TypeOverride (type=OptionType.FILE_PATH, options="upload", values="false") private volatile File f;This operand is interpreted as a file by default, but if another option ("--upload") is "false", then it is just a path to a file. A FILE_PATH is treated specially by the client in that its absolute value is sent from the client to the server.
Note that no dependency graph is calculated here. @TypeOverride is intended for simple cases where there are primary options and others depend on them.
@Operand (type=OptionType.STRING, required=true) private final String[] names; OR: @Operand (type=OptionType.STRING, required=true) private final List < String > names;Note that for the multiple operand case, you must use either a List or an Array. If a command does not have any field annotated with @Operand, it does not take any operand and if such a command line is presented with an operand (when all options run out (no pun intended) what remain on the command line are operands) it is a syntax error.
@Operand (type=OptionType.FILE, required=true) private final File[] files; OR: @Operand (type=OptionType.FILE, required=true) private final List < File > files;