| 1 |
/* |
| 2 |
* @(#)FloatConverter.java 3/9/2005 |
| 3 |
* |
| 4 |
* Copyright 2002 - 2005 JIDE Software Inc. All rights reserved. |
| 5 |
*/ |
| 6 |
package com.jidesoft.converter; |
| 7 |
|
| 8 |
import java.text.NumberFormat; |
| 9 |
|
| 10 |
|
| 11 |
/** |
| 12 |
* Converter which converts Float to String and converts it back. |
| 13 |
*/ |
| 14 |
public class FloatConverter extends NumberConverter { |
| 15 |
public FloatConverter() { |
| 16 |
} |
| 17 |
|
| 18 |
public FloatConverter(NumberFormat format) { |
| 19 |
super(format); |
| 20 |
} |
| 21 |
|
| 22 |
public Object fromString(String string, ConverterContext context) { |
| 23 |
Number number = parseNumber(string); |
| 24 |
return number != null ? number.floatValue() : null; |
| 25 |
} |
| 26 |
|
| 27 |
public boolean supportFromString(String string, ConverterContext context) { |
| 28 |
return true; |
| 29 |
} |
| 30 |
} |