@@ -103,13 +103,22 @@ public class CommandLine {
103103
104104 /** <p>Query to see if an option has been set.</p>
105105 *
106- * @param opt Short single-character name of the option
106+ * @param opt Short name of the option
107107 * @return true if set, false if not
108108 */
109109 public boolean hasOption (String opt ) {
110110 return options .containsKey ( opt );
111111 }
112112
113+ /** <p>Query to see if an option has been set.</p>
114+ *
115+ * @param opt character name of the option
116+ * @return true if set, false if not
117+ */
118+ public boolean hasOption ( char opt ) {
119+ return hasOption ( String .valueOf ( opt ) );
120+ }
121+
113122 /**
114123 * @param opt the name of the option
115124 * @return the type of opt
@@ -120,6 +129,14 @@ public Object getOptionObject( String opt ) {
120129 return res == null ? null : TypeHandler .createValue (res , type );
121130 }
122131
132+ /**
133+ * @param opt the name of the option
134+ * @return the type of opt
135+ */
136+ public Object getOptionObject ( char opt ) {
137+ return getOptionObject ( String .valueOf ( opt ) );
138+ }
139+
123140 /** <p>Retrieve the argument, if any, of an option.</p>
124141 *
125142 * @param opt the name of the option
@@ -129,18 +146,36 @@ public String getOptionValue( String opt ) {
129146 return (String )((Option )options .get ( opt )).getValue ();
130147 }
131148
149+ /** <p>Retrieve the argument, if any, of an option.</p>
150+ *
151+ * @param opt the character name of the option
152+ * @return Value of the argument if option is set, and has an argument, else null.
153+ */
154+ public String getOptionValue ( char opt ) {
155+ return getOptionValue ( String .valueOf ( opt ) );
156+ }
157+
132158 /** <p>Retrieves the array of values, if any, of an option.</p>
133159 *
134- * @param opt Single-character name of the option
160+ * @param opt string name of the option
135161 * @return An array of values if the option is set, and has an argument, else null.
136162 */
137163 public String [] getOptionValues ( String opt ) {
138164 return (String [])((Option )options .get ( opt )).getValues ();
139165 }
166+
167+ /** <p>Retrieves the array of values, if any, of an option.</p>
168+ *
169+ * @param opt character name of the option
170+ * @return An array of values if the option is set, and has an argument, else null.
171+ */
172+ public String [] getOptionValues ( char opt ) {
173+ return getOptionValues ( String .valueOf ( opt ) );
174+ }
140175
141- /** <p>Retrieve the argument, if any, of an option.</p>
176+ /** <p>Retrieve the argument, if any, of an option.</p>
142177 *
143- * @param opt Short single-character name of the option
178+ * @param opt name of the option
144179 * @param defaultValue is the default value to be returned if the option is not specified
145180 * @return Value of the argument if option is set, and has an argument, else null.
146181 */
@@ -149,6 +184,16 @@ public String getOptionValue( String opt, String defaultValue ) {
149184 return ( answer != null ) ? answer : defaultValue ;
150185 }
151186
187+ /** <p>Retrieve the argument, if any, of an option.</p>
188+ *
189+ * @param opt character name of the option
190+ * @param defaultValue is the default value to be returned if the option is not specified
191+ * @return Value of the argument if option is set, and has an argument, else null.
192+ */
193+ public String getOptionValue ( char opt , String defaultValue ) {
194+ return getOptionValue ( String .valueOf ( opt ), defaultValue );
195+ }
196+
152197 /** <p>Retrieve any left-over non-recognized options and arguments</p>
153198 *
154199 * @return an array of remaining items passed in but not parsed
0 commit comments