@@ -103,7 +103,7 @@ private static Class<?> toType(final Class<?> type) {
103103 private char valueSeparator ;
104104
105105 /** multiple values are within a single argument separated by valueSeparator char */
106- private boolean valuesAsList ;
106+ private boolean valueSeparatorUsedForSingleArgument ;
107107
108108 /**
109109 * Constructs a new {@code Builder} with the minimum required parameters for an {@code Option} instance.
@@ -318,7 +318,7 @@ public Builder valueSeparator() {
318318 }
319319
320320 /**
321- * The Option will use {@code sep} as a means to separate java-property-style argument values
321+ * The Option will use {@code sep} as a means to separate java-property-style argument values.
322322 *
323323 * Method is mutually exclusive to listValueSeparator() method.
324324 * <p>
@@ -336,7 +336,7 @@ public Builder valueSeparator() {
336336 * String propertyValue = line.getOptionValues("D")[1]; // will be "value"
337337 * </pre>
338338 *
339- * In the above example (unlimited args) , followup arguments are interpreted
339+ * In the above example, followup arguments are interpreted
340340 * to be additional values to this option, needs to be terminated with -- so that
341341 * others options or args can follow.
342342 *
@@ -359,26 +359,28 @@ public Builder listValueSeparator() {
359359 }
360360
361361 /**
362- * defines the separator used to separate a list of values passed in a single arg
362+ * defines the separator used to split a list of values passed in a single argument.
363+ *
364+ * Method is mutually exclusive to valueSeparator() method. In the resulting option,
365+ * isValueSeparatorUsedForSingleArgument() will return true.
363366 *
364- * Method is mutually exclusive to valueSeparator() method.
365367 * <p>
366368 * <strong>Example:</strong>
367369 * </p>
368370 *
369371 * <pre>
370- * final Option colors = Option.builder().option("c").longOpt("colors"). hasArgs().listValueSeparator('|').build();
372+ * final Option colors = Option.builder().option("c").hasArgs().listValueSeparator('|').build();
371373 * final Options options = new Options();
372374 * options.addOption(colors);
373375 *
374376 * final String[] args = {"-c", "red|blue|yellow", "b,c"};
375377 * final DefaultParser parser = new DefaultParser();
376378 * final CommandLine commandLine = parser.parse(options, args, null, true);
377- * String [] colorValues = commandLine.getOptionValues(colors);
379+ * final String [] colorValues = commandLine.getOptionValues(colors);
378380 * // colorValues[0] will be "red"
379381 * // colorValues[1] will be "blue"
380382 * // colorValues[2] will be "yellow"
381- * String arguments = commandLine.getArgs()[0]; // will be b,c
383+ * final String arguments = commandLine.getArgs()[0]; // will be b,c
382384 *
383385 * </pre>
384386 *
@@ -388,7 +390,7 @@ public Builder listValueSeparator() {
388390 */
389391 public Builder listValueSeparator (final char listValueSeparator ) {
390392 this .valueSeparator = listValueSeparator ;
391- this .valuesAsList = true ;
393+ this .valueSeparatorUsedForSingleArgument = true ;
392394 return this ;
393395 }
394396 }
@@ -472,7 +474,7 @@ public static Builder builder(final String option) {
472474 private char valueSeparator ;
473475
474476 /** multiple values are within a single argument separated by valueSeparator char */
475- private boolean valuesAsList ;
477+ private boolean valueSeparatorUsedForSingleArgument ;
476478
477479 /**
478480 * Private constructor used by the nested Builder class.
@@ -492,7 +494,7 @@ private Option(final Builder builder) {
492494 this .type = builder .type ;
493495 this .valueSeparator = builder .valueSeparator ;
494496 this .converter = builder .converter ;
495- this .valuesAsList = builder .valuesAsList ;
497+ this .valueSeparatorUsedForSingleArgument = builder .valueSeparatorUsedForSingleArgument ;
496498 }
497499
498500 /**
@@ -877,13 +879,24 @@ public boolean isRequired() {
877879 }
878880
879881 /**
880- * Tests whether multiple values are expected in a single argument separated by a separation character
882+ * Tests whether multiple values are expected in a single argument split by a separation character
883+ *
884+ * @return boolean true when the builder's listValueSeparator() method was used. Multiple values are expected in a single argument and
885+ * are split by a separation character.
886+ * @since 1.10.0
887+ */
888+ public boolean isValueSeparatorUsedForSingleArgument () {
889+ return valueSeparatorUsedForSingleArgument ;
890+ }
891+
892+ /**
893+ * Set this to true to use the valueSeparator only on a single argument. See also builder's listValueSeparator() method.
881894 *
882- * @return boolean true when multiple values are expected in a single separated by a separation character
895+ * @param valueSeparatorUsedForSingleArgument the new value for this property
883896 * @since 1.10.0
884897 */
885- public boolean areValuesAsList ( ) {
886- return valuesAsList ;
898+ public void setValueSeparatorUsedForSingleArgument ( final boolean valueSeparatorUsedForSingleArgument ) {
899+ this . valueSeparatorUsedForSingleArgument = valueSeparatorUsedForSingleArgument ;
887900 }
888901
889902 /**
0 commit comments