1- /**
1+ /*
22 * Copyright 2003-2004 The Apache Software Foundation
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
2121
2222/**
2323 * A Validator for a list of known string values.
24+ *
25+ * The following example shows how to limit the valid values
26+ * for the color argument to 'red', 'green', or 'blue'.
27+ *
28+ * <pre>
29+ * Set values = new HashSet();
30+ * values.add("red");
31+ * values.add("green");
32+ * values.add("blue");
33+ * ...
34+ * ArgumentBuilder builder = new ArgumentBuilder();
35+ * Argument color =
36+ * builder.withName("color");
37+ * .withValidator(new EnumValidator(values));
38+ * </pre>
2439 *
2540 * @author John Keyes
2641 */
@@ -30,10 +45,9 @@ public class EnumValidator implements Validator {
3045 private Set validValues ;
3146
3247 /**
33- * Creates a new StringValidator for the specified values.
48+ * Creates a new EnumValidator for the specified values.
3449 *
35- * @param values
36- * the list of permitted values
50+ * @param values The list of permitted values
3751 */
3852 public EnumValidator (final Set values ) {
3953 this .validValues = values ;
@@ -59,7 +73,7 @@ public void validate(final List values) throws InvalidArgumentException {
5973 }
6074
6175 /**
62- * Returns the permitted values in a String
76+ * Returns the permitted values in a comma separated String
6377 *
6478 * @return String formatted list of values
6579 */
@@ -85,14 +99,14 @@ private String getValuesAsString() {
8599 }
86100
87101 /**
88- * @return Returns the validValues .
102+ * @return Returns the Set of valid argument values .
89103 */
90104 public Set getValidValues () {
91105 return validValues ;
92106 }
93107
94108 /**
95- * @param validValues The validValues to set .
109+ * @param validValues The Set of valid argument values .
96110 */
97111 public void setValidValues (Set validValues ) {
98112 this .validValues = validValues ;
0 commit comments