38 |
|
|
39 |
package java.sql; |
package java.sql; |
40 |
|
|
41 |
|
import java.text.ParseException; |
42 |
import java.text.SimpleDateFormat; |
import java.text.SimpleDateFormat; |
43 |
|
|
44 |
/** |
/** |
56 |
*/ |
*/ |
57 |
private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); |
private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); |
58 |
|
|
59 |
|
/** |
60 |
|
* This method always throws an IllegalArgumentException. |
61 |
|
* |
62 |
|
* @throws IllegalArgumentException when it's called. |
63 |
|
* @deprecated |
64 |
|
*/ |
65 |
|
public int getDate() throws IllegalArgumentException { |
66 |
|
throw new IllegalArgumentException(); |
67 |
|
} |
68 |
|
|
69 |
|
/** |
70 |
|
* This method always throws an IllegalArgumentException. |
71 |
|
* |
72 |
|
* @throws IllegalArgumentException when it's called. |
73 |
|
* @deprecated |
74 |
|
*/ |
75 |
|
public int getDay() throws IllegalArgumentException { |
76 |
|
throw new IllegalArgumentException(); |
77 |
|
} |
78 |
|
|
79 |
|
/** |
80 |
|
* This method always throws an IllegalArgumentException. |
81 |
|
* |
82 |
|
* @throws IllegalArgumentException when it's called. |
83 |
|
* @deprecated |
84 |
|
*/ |
85 |
|
public int getMonth() throws IllegalArgumentException { |
86 |
|
throw new IllegalArgumentException(); |
87 |
|
} |
88 |
|
|
89 |
|
/** |
90 |
|
* This method always throws an IllegalArgumentException. |
91 |
|
* |
92 |
|
* @throws IllegalArgumentException when it's called. |
93 |
|
* @deprecated |
94 |
|
*/ |
95 |
|
public int getYear() throws IllegalArgumentException { |
96 |
|
throw new IllegalArgumentException(); |
97 |
|
} |
98 |
|
|
99 |
|
/** |
100 |
|
* This method always throws an IllegalArgumentException. |
101 |
|
* |
102 |
|
* @throws IllegalArgumentException when it's called. |
103 |
|
* @deprecated |
104 |
|
*/ |
105 |
|
public void setDate(int newValue) throws IllegalArgumentException { |
106 |
|
throw new IllegalArgumentException(); |
107 |
|
} |
108 |
|
|
109 |
|
/** |
110 |
|
* This method always throws an IllegalArgumentException. |
111 |
|
* |
112 |
|
* @throws IllegalArgumentException when it's called. |
113 |
|
* @deprecated |
114 |
|
*/ |
115 |
|
public void setMonth(int newValue) throws IllegalArgumentException { |
116 |
|
throw new IllegalArgumentException(); |
117 |
|
} |
118 |
|
|
119 |
|
/** |
120 |
|
* This method always throws an IllegalArgumentException. |
121 |
|
* |
122 |
|
* @throws IllegalArgumentException when it's called. |
123 |
|
* @deprecated |
124 |
|
*/ |
125 |
|
public void setYear(int newValue) throws IllegalArgumentException { |
126 |
|
throw new IllegalArgumentException(); |
127 |
|
} |
128 |
|
|
129 |
/** |
/** |
130 |
* This method returns a new instance of this class by parsing a |
* This method returns a new instance of this class by parsing a |
140 |
try |
try |
141 |
{ |
{ |
142 |
java.util.Date d = (java.util.Date) sdf.parseObject(str); |
java.util.Date d = (java.util.Date) sdf.parseObject(str); |
143 |
return new Time(d.getTime()); |
|
144 |
|
if (d == null) { |
145 |
|
throw new IllegalArgumentException(str); |
146 |
|
} |
147 |
|
else { |
148 |
|
return new Time(d.getTime()); |
149 |
|
} |
150 |
} |
} |
151 |
catch (Exception e) |
catch (ParseException e) |
152 |
{ |
{ |
153 |
return null; |
throw new IllegalArgumentException(str); |
154 |
} |
} |
155 |
} |
} |
156 |
|
|