Revision 2172 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDouble.java

View differences:

CoerceToDouble.java
27 27
import java.text.ParsePosition;
28 28
import java.util.Date;
29 29
import org.gvsig.tools.dataTypes.AbstractCoercion;
30
import org.gvsig.tools.dataTypes.Coercion;
30 31

  
31 32
import org.gvsig.tools.dataTypes.CoercionException;
32 33
import org.gvsig.tools.dataTypes.DataTypeUtils;
......
41 42
    if (value == null || value instanceof Double) {
42 43
      return value;
43 44
    }
44
    return coerce(value, DataTypeUtils.coerceContextDefaultLocale());
45
    return coerce(value, DataTypeUtils.coerceContextDefaultDecimal());
45 46
  }
46 47

  
47 48
  @Override
......
99 100
    }
100 101
  }
101 102

  
103
  public static void main(String[] args) throws CoercionException {
104
    Coercion toDouble = new CoerceToDouble();
105
    
106
    Double x = (double) toDouble.coerce("10.5");
107
    System.out.println(x);
108
    x = (double) toDouble.coerce("123456789.5");
109
    System.out.println(x);
110
    x = (double) toDouble.coerce("123,456,789.5");
111
    System.out.println(x);
112
  }
102 113
}

Also available in: Unified diff