Changeset 3590
- Timestamp:
- Jul 23, 2007, 12:43:11 PM (16 years ago)
- Location:
- trunk/src/core/net/sf/basedb
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/ExtendedProperty.java
r3562 r3590 196 196 Numeric properties are parsed with the specified number format. 197 197 @param value The value to parse 198 @param numberFormat The number format, or null to use Float.valueOf orDouble.valueOf198 @param numberFormat The number format, or null to use Double.valueOf 199 199 @return An object 200 200 @throws InvalidDataException If the string cannot be converted to the correct type … … 214 214 parsed. Otherwise an exception is thrown. 215 215 @param value The value to parse 216 @param numberFormat The number format, or null to use Float.valueOf orDouble.valueOf216 @param numberFormat The number format, or null to use Double.valueOf 217 217 @param nullIfException TRUE to return null in case the string can't be parsed, 218 218 FALSE to throw an exception -
trunk/src/core/net/sf/basedb/core/Type.java
r3472 r3590 70 70 { 71 71 if (value == null) return null; 72 return new Integer( Float.valueOf(value).intValue());72 return new Integer(Double.valueOf(value).intValue()); 73 73 } 74 74 public Number convertNumber(Number num) … … 94 94 throws InvalidDataException 95 95 { 96 return new Long( Float.valueOf(value).intValue());96 return new Long(Double.valueOf(value).intValue()); 97 97 } 98 98 public Number convertNumber(Number num) -
trunk/src/core/net/sf/basedb/util/Values.java
r3190 r3590 65 65 if (value != null) 66 66 { 67 try { return Float.valueOf(value).intValue(); }67 try { return Double.valueOf(value).intValue(); } 68 68 catch (Throwable t) {} 69 69 } … … 75 75 if (value != null) 76 76 { 77 try { return Float.valueOf(value).intValue(); }77 try { return Double.valueOf(value).intValue(); } 78 78 catch (Throwable t) {} 79 79 } -
trunk/src/core/net/sf/basedb/util/parser/ColumnMapper.java
r3472 r3590 75 75 @param nullIfException If TRUE, the mapper returns null for unparsable numeric 76 76 values, otherwise an excption is thrown 77 @param parser The parser to use or null to use Float.valueOf()77 @param parser The parser to use or null to use Double.valueOf() 78 78 @since 2.4 79 79 */ … … 102 102 public Integer getInt(Data data) 103 103 { 104 return getFloat(getValue(data)).intValue(); 104 Double d = getDouble(getValue(data)); 105 return d == null ? null : d.intValue(); 105 106 } 106 107 public Float getFloat(Data data) 107 108 { 108 return getFloat(getValue(data)); 109 Double d = getDouble(getValue(data)); 110 return d == null ? null : d.floatValue(); 109 111 } 110 112 // ------------------------------------------- … … 120 122 // ------------------------------------------- 121 123 122 private Float getFloat(String value)124 private Double getDouble(String value) 123 125 { 124 126 if (value == null) return null; 125 Float f= null;127 Double d = null; 126 128 if (parser == null) 127 129 { 128 130 try 129 131 { 130 f = Float.valueOf(value);132 d = Double.valueOf(value); 131 133 } 132 134 catch (RuntimeException rex) … … 137 139 else 138 140 { 139 f = (Float)Type.FLOAT.parseString(value, parser, nullIfException);141 d = (Double)Type.DOUBLE.parseString(value, parser, nullIfException); 140 142 } 141 return f;143 return d; 142 144 } 143 145 -
trunk/src/core/net/sf/basedb/util/parser/CompoundMapper.java
r3472 r3590 117 117 try 118 118 { 119 intValue = Integer.parseInt(stringValue);119 intValue = Double.valueOf(stringValue).intValue(); 120 120 } 121 121 catch (RuntimeException rex) -
trunk/src/core/net/sf/basedb/util/parser/ConstantMapper.java
r3472 r3590 59 59 Create a constant mapper using a specific number formatter as it's parser. 60 60 @param constant The constant expression 61 @param parser The number format to use or null to use Float.valueOf()61 @param parser The number format to use or null to use Double.valueOf() 62 62 @since 2.2 63 63 @deprecated Use {@link ConstantMapper#ConstantMapper(String, NumberFormat, boolean)} … … 71 71 Create a constant mapper using a specific number formatter as it's parser. 72 72 @param constant The constant expression 73 @param parser The number format to use or null to use Float.valueOf()73 @param parser The number format to use or null to use Double.valueOf() 74 74 @param nullIfException If TRUE, the mapper returns null for unparsable numeric 75 75 values, otherwise an excption is thrown … … 151 151 else 152 152 { 153 asFloat = Float.valueOf(constant);153 asFloat = Double.valueOf(constant).floatValue(); 154 154 } 155 155 }
Note: See TracChangeset
for help on using the changeset viewer.