Revision 728 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToTimestamp.java
CoerceToTimestamp.java | ||
---|---|---|
43 | 43 |
* @author jldominguez |
44 | 44 |
* |
45 | 45 |
*/ |
46 |
public class CoerceToTimestamp implements Coercion {
|
|
46 |
public class CoerceToTimestamp extends CoerceToTime {
|
|
47 | 47 |
|
48 | 48 |
public static final String NOW_STRING = "now"; |
49 | 49 |
|
... | ... | |
76 | 76 |
// ----------- (3) Accept "now" |
77 | 77 |
if (NOW_STRING.compareToIgnoreCase(str.trim()) == 0) { |
78 | 78 |
|
79 |
return new Timestamp(System.currentTimeMillis()); |
|
80 |
|
|
81 |
} else { |
|
82 |
/* |
|
83 |
* Finally throw exception |
|
84 |
*/ |
|
85 |
throw new CoercionException( |
|
86 |
"Unable to coerce to Timestamp from: '" + str + "'"); |
|
79 |
resp = new Timestamp(System.currentTimeMillis()); |
|
87 | 80 |
} |
81 |
|
|
82 |
if (resp != null) { |
|
83 |
return resp; |
|
84 |
} |
|
85 |
|
|
86 |
/* |
|
87 |
* Finally try as time |
|
88 |
*/ |
|
89 |
return super.coerce(value); |
|
88 | 90 |
} |
89 | 91 |
} |
90 | 92 |
|
Also available in: Unified diff