/** * Creates an Option using the specified parameters. * * @param opt short representation of the option * @param longOpt the long representation of the option * @param hasArg specifies whether the Option takes an argument or not * @param description describes the function of the option * * @throws IllegalArgumentException if there are any non valid * Option characters in <code>opt</code>. */ public Option(string opt, string longOpt, bool hasArg, string description) { // ensure that the option is valid OptionValidator.ValidateOption(opt); this.opt = opt; this.longOpt = longOpt; // if hasArg is set then the number of arguments is 1 if (hasArg) { this.numberOfArgs = 1; } this.description = description; }
/** * Constructs a new <code>Builder</code> with the minimum * required parameters for an <code>Option</code> instance. * * @param opt short representation of the option * @throws IllegalArgumentException if there are any non valid Option characters in {@code opt} */ public OptionBuilder(string opt) { OptionValidator.ValidateOption(opt); this.opt = opt; }