File tree Expand file tree Collapse file tree
src/java/org/apache/commons/cli2/validation Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- /**
2- * Copyright 2003-2004 The Apache Software Foundation
1+ /*
2+ * Copyright 2003-2005 The Apache Software Foundation
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
2222import java .util .ListIterator ;
2323
2424/**
25- * @author John Keyes
25+ * A Validator for date and time value(s).
26+ *
27+ * The following example shows how to validate that
28+ * an argument value(s) is a Date of the following
29+ * type: d/M/yy (see {@link java.text.DateFormat}).
30+ *
31+ * <pre>
32+ * DateFormat date = new SimpleDateFormat("d/M/yy");
33+ * ...
34+ * ArgumentBuilder builder = new ArgumentBuilder();
35+ * Argument dateFormat =
36+ * builder.withName("date");
37+ * .withValidator(new DateValidator(dateFormat));
38+ * </pre>
39+ *
40+ * The following example shows how to validate that
41+ * an argument value(s) is a time of the following
42+ * type: HH:mm:ss (see {@link java.text.DateFormat}).
43+ *
44+ * <pre>
45+ * DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
46+ * ...
47+ * ArgumentBuilder builder = new ArgumentBuilder();
48+ * Argument time =
49+ * builder.withName("time");
50+ * .withValidator(new DateValidator(timeFormat));
51+ * </pre>
2652 *
53+ * @author John Keyes
54+ *
2755 * @see java.text.DateFormat
2856 */
2957public class DateValidator implements Validator {
Original file line number Diff line number Diff line change @@ -99,13 +99,17 @@ private String getValuesAsString() {
9999 }
100100
101101 /**
102+ * Returns the Set of valid argument values.
103+ *
102104 * @return Returns the Set of valid argument values.
103105 */
104106 public Set getValidValues () {
105107 return validValues ;
106108 }
107109
108110 /**
111+ * Specifies the Set of valid argument values.
112+ *
109113 * @param validValues The Set of valid argument values.
110114 */
111115 public void setValidValues (Set validValues ) {
You can’t perform that action at this time.
0 commit comments