Skip to content

Commit f641323

Browse files
committed
Replaced fully qualified names with imports
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/branches/cli-1.x@678690 13f79535-47bb-0310-9956-ffa450edef68
1 parent 81fe716 commit f641323

2 files changed

Lines changed: 29 additions & 19 deletions

File tree

src/java/org/apache/commons/cli/PatternOptionBuilder.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.commons.cli;
1819

20+
import java.io.File;
21+
import java.io.FileInputStream;
22+
import java.net.URL;
23+
import java.util.Date;
24+
1925
/**
2026
* <p>
2127
* Allows Options to be created from a single String.
@@ -49,36 +55,35 @@
4955
public class PatternOptionBuilder {
5056

5157
/** String class */
52-
public static final Class STRING_VALUE = java.lang.String.class;
58+
public static final Class STRING_VALUE = String.class;
5359

5460
/** Object class */
55-
public static final Class OBJECT_VALUE = java.lang.Object.class;
61+
public static final Class OBJECT_VALUE = Object.class;
5662

5763
/** Number class */
58-
public static final Class NUMBER_VALUE = java.lang.Number.class;
64+
public static final Class NUMBER_VALUE = Number.class;
5965

6066
/** Date class */
61-
public static final Class DATE_VALUE = java.util.Date.class;
67+
public static final Class DATE_VALUE = Date.class;
6268

6369
/** Class class */
64-
public static final Class CLASS_VALUE = java.lang.Class.class;
70+
public static final Class CLASS_VALUE = Class.class;
6571

6672
/// can we do this one??
6773
// is meant to check that the file exists, else it errors.
6874
// ie) it's for reading not writing.
6975

7076
/** FileInputStream class */
71-
public static final Class EXISTING_FILE_VALUE =
72-
java.io.FileInputStream.class;
77+
public static final Class EXISTING_FILE_VALUE = FileInputStream.class;
7378

7479
/** File class */
75-
public static final Class FILE_VALUE = java.io.File.class;
80+
public static final Class FILE_VALUE = File.class;
7681

7782
/** File array class */
78-
public static final Class FILES_VALUE = java.io.File[].class;
83+
public static final Class FILES_VALUE = File[].class;
7984

8085
/** URL class */
81-
public static final Class URL_VALUE = java.net.URL.class;
86+
public static final Class URL_VALUE = URL.class;
8287

8388
/**
8489
* <p>Retrieve the class that <code>ch</code> represents.</p>

src/test/org/apache/commons/cli/PatternOptionBuilderTest.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
package org.apache.commons.cli;
1919

20+
import java.io.File;
21+
import java.net.URL;
22+
import java.util.Calendar;
23+
import java.util.Vector;
24+
2025
import junit.framework.TestCase;
2126

2227
/**
@@ -36,27 +41,27 @@ public void testSimplePattern() throws Exception
3641

3742
assertEquals("flag a", "foo", line.getOptionValue("a"));
3843
assertEquals("string flag a", "foo", line.getOptionObject("a"));
39-
assertEquals("object flag b", new java.util.Vector(), line.getOptionObject("b"));
44+
assertEquals("object flag b", new Vector(), line.getOptionObject("b"));
4045
assertTrue("boolean true flag c", line.hasOption("c"));
4146
assertFalse("boolean false flag d", line.hasOption("d"));
42-
assertEquals("file flag e", new java.io.File("build.xml"), line.getOptionObject("e"));
43-
assertEquals("class flag f", java.util.Calendar.class, line.getOptionObject("f"));
47+
assertEquals("file flag e", new File("build.xml"), line.getOptionObject("e"));
48+
assertEquals("class flag f", Calendar.class, line.getOptionObject("f"));
4449
assertEquals("number flag n", new Double(4.5), line.getOptionObject("n"));
45-
assertEquals("url flag t", new java.net.URL("http://jakarta.apache.org/"), line.getOptionObject("t"));
50+
assertEquals("url flag t", new URL("http://jakarta.apache.org/"), line.getOptionObject("t"));
4651

4752
// tests the char methods of CommandLine that delegate to the String methods
4853
assertEquals("flag a", "foo", line.getOptionValue('a'));
4954
assertEquals("string flag a", "foo", line.getOptionObject('a'));
50-
assertEquals("object flag b", new java.util.Vector(), line.getOptionObject('b'));
55+
assertEquals("object flag b", new Vector(), line.getOptionObject('b'));
5156
assertTrue("boolean true flag c", line.hasOption('c'));
5257
assertFalse("boolean false flag d", line.hasOption('d'));
53-
assertEquals("file flag e", new java.io.File("build.xml"), line.getOptionObject('e'));
54-
assertEquals("class flag f", java.util.Calendar.class, line.getOptionObject('f'));
58+
assertEquals("file flag e", new File("build.xml"), line.getOptionObject('e'));
59+
assertEquals("class flag f", Calendar.class, line.getOptionObject('f'));
5560
assertEquals("number flag n", new Double(4.5), line.getOptionObject('n'));
56-
assertEquals("url flag t", new java.net.URL("http://jakarta.apache.org/"), line.getOptionObject('t'));
61+
assertEquals("url flag t", new URL("http://jakarta.apache.org/"), line.getOptionObject('t'));
5762

5863
/// DATES NOT SUPPORTED YET.
59-
// assertEquals("number flag t", new java.util.Date(1023400137276L), line.getOptionObject('z'));
64+
// assertEquals("number flag t", new Date(1023400137276L), line.getOptionObject('z'));
6065
// input is: "Thu Jun 06 17:48:57 EDT 2002"
6166
}
6267
}

0 commit comments

Comments
 (0)