5858 * <http://www.apache.org/>.
5959 *
6060 */
61-
6261package org .apache .commons .cli ;
6362
6463import java .util .Collection ;
6867import java .util .LinkedList ;
6968import java .util .Map ;
7069
71- /** <p>Represents list of arguments parsed against
70+ /**
71+ * <p>Represents list of arguments parsed against
7272 * a {@link Options} descriptor.<p>
7373 *
7474 * <p>It allows querying of a boolean {@link #hasOption(String opt)},
8181 * @author bob mcwhirter (bob @ werken.com)
8282 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
8383 * @author John Keyes (jbjk at mac.com)
84- *
85- * @version $Revision: 1.4 $
8684 */
8785public class CommandLine {
8886
@@ -104,7 +102,8 @@ public class CommandLine {
104102 CommandLine () {
105103 }
106104
107- /** <p>Query to see if an option has been set.</p>
105+ /**
106+ * <p>Query to see if an option has been set.</p>
108107 *
109108 * @param opt Short name of the option
110109 * @return true if set, false if not
@@ -113,7 +112,8 @@ public boolean hasOption(String opt) {
113112 return options .containsKey ( opt );
114113 }
115114
116- /** <p>Query to see if an option has been set.</p>
115+ /**
116+ * <p>Query to see if an option has been set.</p>
117117 *
118118 * @param opt character name of the option
119119 * @return true if set, false if not
@@ -123,8 +123,10 @@ public boolean hasOption( char opt ) {
123123 }
124124
125125 /**
126+ * <p>Return the <code>Object</code> type of this <code>Option</code>.</p>
127+ *
126128 * @param opt the name of the option
127- * @return the type of opt
129+ * @return the type of this <code>Option</code>
128130 */
129131 public Object getOptionObject ( String opt ) {
130132 String res = getOptionValue ( opt );
@@ -134,36 +136,44 @@ public Object getOptionObject( String opt ) {
134136 }
135137
136138 /**
139+ * <p>Return the <code>Object</code> type of this <code>Option</code>.</p>
140+ *
137141 * @param opt the name of the option
138142 * @return the type of opt
139143 */
140144 public Object getOptionObject ( char opt ) {
141145 return getOptionObject ( String .valueOf ( opt ) );
142146 }
143147
144- /** <p>Retrieve the argument, if any, of an option.</p>
148+ /**
149+ * <p>Retrieve the argument, if any, of this option.</p>
145150 *
146151 * @param opt the name of the option
147- * @return Value of the argument if option is set, and has an argument, else null.
152+ * @return Value of the argument if option is set, and has an argument,
153+ * otherwise null.
148154 */
149155 public String getOptionValue ( String opt ) {
150156 String [] values = getOptionValues (opt );
151157 return (values == null ) ? null : values [0 ];
152158 }
153159
154- /** <p>Retrieve the argument, if any, of an option.</p>
160+ /**
161+ * <p>Retrieve the argument, if any, of this option.</p>
155162 *
156163 * @param opt the character name of the option
157- * @return Value of the argument if option is set, and has an argument, else null.
164+ * @return Value of the argument if option is set, and has an argument,
165+ * otherwise null.
158166 */
159167 public String getOptionValue ( char opt ) {
160168 return getOptionValue ( String .valueOf ( opt ) );
161169 }
162170
163- /** <p>Retrieves the array of values, if any, of an option.</p>
171+ /**
172+ * <p>Retrieves the array of values, if any, of an option.</p>
164173 *
165174 * @param opt string name of the option
166- * @return An array of values if the option is set, and has an argument, else null.
175+ * @return Values of the argument if option is set, and has an argument,
176+ * otherwise null.
167177 */
168178 public String [] getOptionValues ( String opt ) {
169179 List values = new java .util .ArrayList ();
@@ -180,49 +190,57 @@ public String[] getOptionValues( String opt ) {
180190 return (values .size () == 0 ) ? null : (String [])values .toArray (new String []{});
181191 }
182192
183- /** <p>Retrieves the array of values, if any, of an option.</p>
193+ /**
194+ * <p>Retrieves the array of values, if any, of an option.</p>
184195 *
185196 * @param opt character name of the option
186- * @return An array of values if the option is set, and has an argument, else null.
197+ * @return Values of the argument if option is set, and has an argument,
198+ * otherwise null.
187199 */
188200 public String [] getOptionValues ( char opt ) {
189201 return getOptionValues ( String .valueOf ( opt ) );
190202 }
191203
192- /** <p>Retrieve the argument, if any, of an option.</p>
204+ /**
205+ * <p>Retrieve the argument, if any, of an option.</p>
193206 *
194207 * @param opt name of the option
195208 * @param defaultValue is the default value to be returned if the option is not specified
196- * @return Value of the argument if option is set, and has an argument, else null.
209+ * @return Value of the argument if option is set, and has an argument,
210+ * otherwise <code>defaultValue</code>.
197211 */
198212 public String getOptionValue ( String opt , String defaultValue ) {
199213 String answer = getOptionValue ( opt );
200214 return ( answer != null ) ? answer : defaultValue ;
201215 }
202216
203- /** <p>Retrieve the argument, if any, of an option.</p>
217+ /**
218+ * <p>Retrieve the argument, if any, of an option.</p>
204219 *
205220 * @param opt character name of the option
206221 * @param defaultValue is the default value to be returned if the option is not specified
207- * @return Value of the argument if option is set, and has an argument, else null.
222+ * @return Value of the argument if option is set, and has an argument,
223+ * otherwise <code>defaultValue</code>.
208224 */
209225 public String getOptionValue ( char opt , String defaultValue ) {
210226 return getOptionValue ( String .valueOf ( opt ), defaultValue );
211227 }
212228
213- /** <p>Retrieve any left-over non-recognized options and arguments</p>
229+ /**
230+ * <p>Retrieve any left-over non-recognized options and arguments</p>
214231 *
215- * @return an array of remaining items passed in but not parsed
232+ * @return remaining items passed in but not parsed as an array
216233 */
217234 public String [] getArgs () {
218235 String [] answer = new String [ args .size () ];
219236 args .toArray ( answer );
220237 return answer ;
221238 }
222239
223- /** <p>Retrieve any left-over non-recognized options and arguments</p>
240+ /**
241+ * <p>Retrieve any left-over non-recognized options and arguments</p>
224242 *
225- * @return List of remaining items passed in but not parsed
243+ * @return remaining items passed in but not parsed as a <code>List</code>.
226244 */
227245 public List getArgList () {
228246 return args ;
0 commit comments