svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.file / org.gvsig.fmap.dal.file.dbf / src / main / java / org / gvsig / fmap / dal / store / dbf / utils / CoerceDateToDbfTimeAsString.java @ 44669
History | View | Annotate | Download (754 Bytes)
1 | 44669 | jjdelcerro | package org.gvsig.fmap.dal.store.dbf.utils; |
---|---|---|---|
2 | |||
3 | import java.util.Date; |
||
4 | import org.gvsig.tools.dataTypes.AbstractCoercion; |
||
5 | import org.gvsig.tools.dataTypes.CoercionException; |
||
6 | import org.gvsig.tools.dataTypes.CoercionContext; |
||
7 | |||
8 | /**
|
||
9 | *
|
||
10 | * @author jjdelcerro
|
||
11 | */
|
||
12 | public class CoerceDateToDbfTimeAsString extends AbstractCoercion |
||
13 | { |
||
14 | |||
15 | private final FieldFormatter formater; |
||
16 | |||
17 | public CoerceDateToDbfTimeAsString() {
|
||
18 | this.formater = new FieldFormatter(); |
||
19 | } |
||
20 | |||
21 | @Override
|
||
22 | public Object coerce(Object value, CoercionContext context) throws CoercionException { |
||
23 | if( value instanceof Date ) { |
||
24 | String s = formater.formatTime((Date) value); |
||
25 | return s;
|
||
26 | } |
||
27 | throw new CoercionException(); |
||
28 | } |
||
29 | |||
30 | } |