Chapter 9. Qualified Switches

The QualifiedSwitch class was introduced in version 1.03 and is currently experimental. QualifiedSwitch extends FlaggedOption, allowing any behavior you can obtain from that class.

The benefit provided by QualifiedSwitch is that its presence on the command line can be determined via JSAPResult.getBoolean(id), and its qualifier values can be obtained via the normal JSAPResult.getXXX() and JSAPResult.getXXXArray() methods.

Note

If you expect a boolean qualifier, JSAPResult.getBoolean(id) will return an indication of whether the switch was present on the command line rather than the qualifier value. This is overcome by using JSAPResult.getBooleanArray(id), which will return an array of only the boolean qualifier values.

JSAP's QualifiedSwitch implementation was generously contributed by Klaus-Peter Berg of Germany.