Revision 44951 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java

View differences:

DefaultFeature.java
73 73
import org.gvsig.tools.exception.BaseRuntimeException;
74 74
import org.gvsig.tools.lang.Cloneable;
75 75
import org.gvsig.fmap.dal.feature.FeatureExtraColumns;
76
import org.gvsig.tools.dataTypes.DataType;
76 77

  
77 78
@SuppressWarnings("UseSpecificCatch")
78 79
public class DefaultFeature implements Feature, EvaluatorData, Cloneable {
......
806 807
                value = getter.getter(value);
807 808
            }
808 809
        }
810
        DataType dataType = featureAttributeDescriptor.getDataType();
811
        Class<? extends DataType> theClass = dataType.getClass();
812
        if( theClass!=null && !theClass.isInstance(value) ) {
813
            try {
814
                value = this.getDataTypesManager().coerce(dataType.getType(), value);
815
            } catch (CoercionException e) {
816
                    throw new IllegalArgumentException(
817
                            "Can't convert to "+theClass.getName()+
818
                            " from '"+value.getClass().getName()+
819
                            "' with value '"+value.toString()+"'.");
820
            }
821
        }
809 822
        if( featureAttributeDescriptor.getType()==DataTypes.GEOMETRY ) {
810 823
            if( value != null ) {
811 824
                Geometry geom = (Geometry)value;

Also available in: Unified diff