Author: tn Date: Sun Feb 17 22:12:22 2013 New Revision: 1447088 URL: http://svn.apache.org/r1447088 Log: [CLI-224] Add hasArgs and hasArg method to new Builder.
Modified: commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java Modified: commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java?rev=1447088&r1=1447087&r2=1447088&view=diff ============================================================================== --- commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java (original) +++ commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java Sun Feb 17 22:12:22 2013 @@ -932,6 +932,16 @@ public class Option implements Cloneable } /** + * Indicates that the Option will require an argument. + * + * @return this builder, to allow method chaining + */ + public Builder hasArg() + { + return hasArg(true); + } + + /** * Indicates if the Option has an argument or not. * * @param hasArg specifies whether the Option takes an argument or not @@ -943,7 +953,18 @@ public class Option implements Cloneable numberOfArgs = hasArg ? 1 : Option.UNINITIALIZED; return this; } - + + /** + * Indicates that the Option can have unlimited argument values. + * + * @return this builder, to allow method chaining + */ + public Builder hasArgs() + { + numberOfArgs = Option.UNLIMITED_VALUES; + return this; + } + /** * Constructs an Option with the values declared by this {@link Builder}. *