Revision 44136
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.impl/src/main/java/org/gvsig/timesupport/impl/coercion/CoerceToDate.java | ||
---|---|---|
13 | 13 |
*/ |
14 | 14 |
public class CoerceToDate implements CoercionWithLocale{ |
15 | 15 |
|
16 |
private final Coercion previous; |
|
17 |
|
|
18 |
public CoerceToDate(Coercion previous) { |
|
19 |
this.previous = previous; |
|
16 |
|
|
17 |
public CoerceToDate() { |
|
20 | 18 |
} |
21 | 19 |
|
22 | 20 |
@Override |
... | ... | |
32 | 30 |
if( o instanceof RelativeInterval ) { |
33 | 31 |
return ((RelativeInterval) o).getStart().toDate(); |
34 | 32 |
} |
35 |
if( this.previous instanceof CoercionWithLocale ) { |
|
36 |
return ((CoercionWithLocale)this.previous).coerce(o, locale); |
|
37 |
} |
|
38 |
return this.previous.coerce(o); |
|
33 |
throw new CoercionException("Can't convert object to date"); |
|
39 | 34 |
} |
40 | 35 |
|
41 | 36 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.impl/src/main/java/org/gvsig/timesupport/impl/TimeSupportDefaultImplLibrary.java | ||
---|---|---|
60 | 60 |
DataTypesManager dataTypesManager = ToolsLocator.getDataTypesManager(); |
61 | 61 |
dataTypesManager.setCoercion(DataTypes.INSTANT, new CoerceToInstant()); |
62 | 62 |
dataTypesManager.setCoercion(DataTypes.INTERVAL, new CoerceToInterval()); |
63 |
dataTypesManager.addCoercion(DataTypes.DATE, new CoerceToDate(dataTypesManager.getCoercion(DataTypes.DATE)));
|
|
63 |
dataTypesManager.addCoercion(DataTypes.DATE, new CoerceToDate()); |
|
64 | 64 |
|
65 | 65 |
TimeSupportManager timeSupportManager = TimeSupportLocator.getManager(); |
66 | 66 |
|
Also available in: Unified diff