Skip to content

Commit 42b00e9

Browse files
author
John Keyes
committed
- fixed errors reported by javadoc tool
- added html and body tags to package.html git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/cli/trunk@267495 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5b14c5c commit 42b00e9

10 files changed

Lines changed: 98 additions & 54 deletions

File tree

src/java/org/apache/commons/cli2/Option.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* Copyright 2003-2005 The Apache Software Foundation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -72,7 +72,7 @@ void process(
7272
* argument. The ListIterator must be restored to the initial state before
7373
* returning the boolean.
7474
*
75-
* @see #canProcess(String)
75+
* @see #canProcess(WriteableCommandLine,String)
7676
* @param arguments
7777
* the ListIterator over String arguments
7878
* @return true if the argument can be processed by this Option
@@ -118,7 +118,7 @@ void validate(final WriteableCommandLine commandLine)
118118
* Builds up a list of HelpLineImpl instances to be presented by HelpFormatter.
119119
*
120120
* @see HelpLine
121-
* @see HelpFormatter
121+
* @see org.apache.commons.cli2.util.HelpFormatter
122122
* @param depth
123123
* the initial indent depth
124124
* @param helpSettings
@@ -156,7 +156,7 @@ void appendUsage(
156156
* Returns a description of the option. This string is used to build help
157157
* messages as in the HelpFormatter.
158158
*
159-
* @see HelpFormatter
159+
* @see org.apache.commons.cli2.util.HelpFormatter
160160
* @return a description of the option.
161161
*/
162162
String getDescription();

src/java/org/apache/commons/cli2/builder/CommandBuilder.java

Lines changed: 51 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,37 @@
2727
*/
2828
public class CommandBuilder {
2929

30+
/** the preferred name of the command */
3031
private String preferredName;
32+
33+
/** the description of the command */
3134
private String description;
35+
36+
/** the aliases of the command */
3237
private Set aliases;
38+
39+
/** whether the command is required or not */
3340
private boolean required;
41+
42+
/** the argument of the command */
3443
private Argument argument;
44+
45+
/** the children of the command */
3546
private Group children;
47+
48+
/** the id of the command */
3649
private int id;
3750

3851
/**
39-
* Creates a new CommandBuilder instance
52+
* Creates a new <code>CommandBuilder</code> instance.
4053
*/
4154
public CommandBuilder() {
4255
reset();
4356
}
4457

4558
/**
46-
* Creates a new Command instance using the properties of the
47-
* CommandBuilder.
59+
* Creates a new <code>Command</code> instance using the properties of the
60+
* <code>CommandBuilder</code>.
4861
*
4962
* @return the new Command instance
5063
*/
@@ -73,8 +86,10 @@ public Command create() {
7386
}
7487

7588
/**
76-
* Resets the CommandBuilder to the defaults for a new Command. The method
77-
* should be called automatically at the end of a create() call.
89+
* Resets the CommandBuilder to the defaults for a new Command.
90+
*
91+
* This method is called automatically at the end of the
92+
* {@link #create() create} method.
7893
*/
7994
public CommandBuilder reset() {
8095
preferredName = null;
@@ -88,12 +103,14 @@ public CommandBuilder reset() {
88103
}
89104

90105
/**
91-
* Sets the name of the command. The first name is used as the preferred
92-
* display name for the Command and then later names are used as aliases.
106+
* Specifies the name for the next <code>Command</code>
107+
* that is created. The first name is used as the preferred
108+
* display name for the <code>Command</code> and then
109+
* later names are used as aliases.
93110
*
94-
* @param name
95-
* a name for the Command
96-
* @return this CommandBuilder
111+
* @param name the name for the next <code>Command</code>
112+
* that is created.
113+
* @return this <code>CommandBuilder</code>.
97114
*/
98115
public CommandBuilder withName(final String name) {
99116
if (preferredName == null) {
@@ -107,58 +124,62 @@ public CommandBuilder withName(final String name) {
107124
}
108125

109126
/**
110-
* Sets the description of the command. The description is used to produce
111-
* online help for the command.
127+
* Specifies the description for the next <code>Command</code>
128+
* that is created. This description is used to produce
129+
* help documentation for the <code>Command</code>.
112130
*
113-
* @param newDescription
114-
* The description of the command
115-
* @return this CommandBuilder
131+
* @param newDescription the description for the next
132+
* <code>Command</code> that is created.
133+
* @return this <code>CommandBuilder</code>.
116134
*/
117135
public CommandBuilder withDescription(final String newDescription) {
118136
this.description = newDescription;
119137
return this;
120138
}
121139

122140
/**
123-
* Use this optionality
124-
* @param newRequired true iff the Option is required
125-
* @return this builder
141+
* Specifies whether the next <code>Command</code> created is
142+
* required or not.
143+
* @param newRequired whether the next <code>Command</code> created is
144+
* required or not.
145+
* @return this <code>CommandBuilder</code>.
126146
*/
127147
public CommandBuilder withRequired(final boolean newRequired) {
128148
this.required = newRequired;
129149
return this;
130150
}
131151

132152
/**
133-
* Sets the children of the Command.
153+
* Specifies the children for the next <code>Command</code>
154+
* that is created.
134155
*
135-
* @param newChildren
136-
* the child options for the Command
137-
* @return this CommandBuilder
156+
* @param newChildren the child options for the next <code>Command</code>
157+
* that is created.
158+
* @return this <code>CommandBuilder</code>.
138159
*/
139160
public CommandBuilder withChildren(final Group newChildren) {
140161
this.children = newChildren;
141162
return this;
142163
}
143164

144165
/**
145-
* Sets the argument of the Command.
166+
* Specifies the argument for the next <code>Command</code>
167+
* that is created.
146168
*
147-
* @param newArgument
148-
* the argument for the Command
149-
* @return this CommandBuilder
169+
* @param newArgument the argument for the next <code>Command</code>
170+
* that is created.
171+
* @return this <code>CommandBuilder</code>.
150172
*/
151173
public CommandBuilder withArgument(final Argument newArgument) {
152174
this.argument = newArgument;
153175
return this;
154176
}
155177

156178
/**
157-
* Sets the id
179+
* Specifies the id for the next <code>Command</code> that is created.
158180
*
159-
* @param newId
160-
* the id of the Command
161-
* @return this CommandBuilder
181+
* @param newId the id for the next <code>Command</code> that is created.
182+
* @return this <code>CommandBuilder</code>.
162183
*/
163184
public final CommandBuilder withId(final int newId) {
164185
this.id = newId;

src/java/org/apache/commons/cli2/option/ArgumentImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* Copyright 2003-2005 The Apache Software Foundation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -87,7 +87,7 @@ public class ArgumentImpl extends OptionImpl implements Argument {
8787
* The object responsible for validating the values
8888
* @param consumeRemaining
8989
* The String used for the "consuming option" group
90-
* @param defaultValues
90+
* @param valueDefaults
9191
* The values to be used if none are specified.
9292
* @param id
9393
* The id of the option, 0 implies automatic assignment.
@@ -124,7 +124,7 @@ public ArgumentImpl(
124124
resources.getMessage("cli.error.minimum.exceeds.maximum"));
125125
}
126126

127-
if (valueDefaults != null) {
127+
if (valueDefaults != null && valueDefaults.size() > 0) {
128128
if (valueDefaults.size() < minimum) {
129129
throw new IllegalArgumentException(
130130
resources.getMessage("cli.error.too.few.defaults"));

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,24 @@
2121
import org.apache.commons.cli2.resource.ResourceHelper;
2222

2323
/**
24-
* A validator checking for classnames
24+
* The <code>ClassValidator</code> validates the string argument
25+
* values are class names.
26+
*
27+
* The following example shows how to validate the 'logger'
28+
* argument value is a class name, that can be instantiated.
29+
*
30+
* <pre>
31+
* ...
32+
* ClassValidator validator = new ClassValidator();
33+
* validator.setInstance(true);
34+
*
35+
* ArgumentBuilder builder = new ArgumentBuilder();
36+
* Argument logger =
37+
* builder.withName("logger");
38+
* .withValidator(validator);
39+
* </pre>
40+
*
41+
* @author John Keyes
2542
*/
2643
public class ClassValidator implements Validator {
2744

@@ -156,7 +173,7 @@ public boolean isInstance() {
156173
* Specifies whether the argument value must represent a
157174
* class that can be instantiated.
158175
*
159-
* @param loadable whether the argument value must
176+
* @param instance whether the argument value must
160177
* represent a class that can be instantiated.
161178
*/
162179
public void setInstance(boolean instance) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
import java.util.ListIterator;
2323

2424
/**
25-
* A Validator for date and time value(s).
25+
* The <code>DateValidator</code> validates the argument values
26+
* are date or time value(s).
2627
*
2728
* The following example shows how to validate that
2829
* an argument value(s) is a Date of the following

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
import java.util.Set;
2121

2222
/**
23-
* A Validator for a list of known string values.
23+
* The <code>EnumValidator</code> validates the string argument
24+
* values are valid.
2425
*
2526
* The following example shows how to limit the valid values
2627
* for the color argument to 'red', 'green', or 'blue'.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public boolean isExisting() {
170170
* Specifies whether the argument values must represent existing
171171
* files/directories.
172172
*
173-
* @param directory specifies whether the argument values must
173+
* @param existing specifies whether the argument values must
174174
* represent existing files/directories.
175175
*/
176176
public void setExisting(boolean existing) {
@@ -211,7 +211,7 @@ public boolean isHidden() {
211211
* Specifies whether the argument values must represent hidden
212212
* files/directories.
213213
*
214-
* @param file specifies whether the argument values must
214+
* @param hidden specifies whether the argument values must
215215
* represent hidden files/directories.
216216
*/
217217
public void setHidden(boolean hidden) {
@@ -233,7 +233,7 @@ public boolean isReadable() {
233233
* Specifies whether the argument values must represent readable
234234
* files/directories.
235235
*
236-
* @param file specifies whether the argument values must
236+
* @param readable specifies whether the argument values must
237237
* represent readable files/directories.
238238
*/
239239
public void setReadable(boolean readable) {
@@ -255,7 +255,7 @@ public boolean isWritable() {
255255
* Specifies whether the argument values must represent writable
256256
* files/directories.
257257
*
258-
* @param file specifies whether the argument values must
258+
* @param writable specifies whether the argument values must
259259
* represent writable files/directories.
260260
*/
261261
public void setWritable(boolean writable) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static NumberValidator getPercentInstance() {
8484
/**
8585
* Returns a <code>NumberValidator</code> for a general-purpose
8686
* number format for the current default locale.
87-
* @returns a <code>NumberValidator</code> for a general-purpose
87+
* @return a <code>NumberValidator</code> for a general-purpose
8888
* number format for the current default locale.
8989
*/
9090
public static NumberValidator getNumberInstance() {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*
2929
* URLs can also be validated based on their scheme by using
3030
* the {@link #setProtocol setProtocol} method, or by using the specified
31-
* {@link UrlValidator(java.lang.String) constructor}.
31+
* {@link #UrlValidator(java.lang.String) constructor}.
3232
*
3333
* The following example shows how to limit the valid values
3434
* for the site argument to 'https' URLs.
@@ -65,7 +65,7 @@ public UrlValidator(final String protocol) {
6565
/**
6666
* Validate the list of values against the list of permitted values.
6767
* If a value is valid, replace the string in the <code>values</code>
68-
* {@link java.util.List} with the {@link java.net.URL} instance.
68+
* {@link java.util.List} with the { java.net.URL} instance.
6969
*
7070
* @see org.apache.commons.cli2.validation.Validator#validate(java.util.List)
7171
*/
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
<html>
2+
<body>
13
Provides classes and interfaces for validating argument values.
24

35
These classes are capable of validating argument values of the following type:
46

57
<ul>
6-
<li>file/directory</li>
7-
<li>number</li>
8-
<li>date/time</li>
9-
<li>URL</li>
10-
<li>enumeration</li>
11-
<li>class</li>
8+
<li>file/directory</li>
9+
<li>number</li>
10+
<li>date/time</li>
11+
<li>URL</li>
12+
<li>enumeration</li>
13+
<li>class</li>
1214
</ul>
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)