Skip to content

Commit cc7da5a

Browse files
author
John Keyes
committed
- updated javadoc
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/cli/trunk@267415 13f79535-47bb-0310-9956-ffa450edef68
1 parent 18cf799 commit cc7da5a

2 files changed

Lines changed: 35 additions & 3 deletions

File tree

src/java/org/apache/commons/cli2/validation/DateValidator.java

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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.
@@ -22,8 +22,36 @@
2222
import 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
*/
2957
public class DateValidator implements Validator {

src/java/org/apache/commons/cli2/validation/EnumValidator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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) {

0 commit comments

Comments
 (0)