Class NumberToStringConverter
java.lang.Object
org.eclipse.core.databinding.conversion.Converter<Object,String>
org.eclipse.core.internal.databinding.conversion.AbstractNumberToStringConverter
org.eclipse.core.databinding.conversion.text.NumberToStringConverter
- All Implemented Interfaces:
IConverter<Object,
String>
public final class NumberToStringConverter
extends org.eclipse.core.internal.databinding.conversion.AbstractNumberToStringConverter
Converts a Number to a String using
Format.format(...)
. This
class is thread safe.
The first type parameter of Converter
is set to Object
to
preserve backwards compatibility, but the argument is meant to always be a
Number
.
This class is a variant of the class with the same name in the parent
package, but it uses java.text
instead of com.ibm.icu
.
Methods on this class that don't take an argument number format use ICU if it
is available on the classpath, otherwise they use java.text
.
- Since:
- 1.9
-
Method Summary
Modifier and TypeMethodDescriptionstatic NumberToStringConverter
static NumberToStringConverter
fromBigDecimal
(Format numberFormat) static NumberToStringConverter
static NumberToStringConverter
fromBigInteger
(Format numberFormat) static NumberToStringConverter
fromByte
(boolean primitive) static NumberToStringConverter
static NumberToStringConverter
fromDouble
(boolean primitive) static NumberToStringConverter
fromDouble
(Format numberFormat, boolean primitive) static NumberToStringConverter
fromFloat
(boolean primitive) static NumberToStringConverter
static NumberToStringConverter
fromInteger
(boolean primitive) static NumberToStringConverter
fromInteger
(Format numberFormat, boolean primitive) static NumberToStringConverter
fromLong
(boolean primitive) static NumberToStringConverter
static NumberToStringConverter
fromShort
(boolean primitive) static NumberToStringConverter
Methods inherited from class org.eclipse.core.internal.databinding.conversion.AbstractNumberToStringConverter
convert
Methods inherited from class org.eclipse.core.databinding.conversion.Converter
getFromType, getToType
-
Method Details
-
fromDouble
- Parameters:
primitive
-true
if the type is a double- Returns:
- Double converter for the default locale
-
fromDouble
- Parameters:
numberFormat
- number format used by the converterprimitive
-true
if the type is a double- Returns:
- Double converter with the provided numberFormat
-
fromLong
- Parameters:
primitive
-true
if the type is a long- Returns:
- Long converter for the default locale
-
fromLong
- Parameters:
numberFormat
- number format used by the converterprimitive
-true
if the type is a long- Returns:
- Long convert with the provided numberFormat
-
fromFloat
- Parameters:
primitive
-true
if the type is a float- Returns:
- Float converter for the default locale
-
fromFloat
- Parameters:
numberFormat
- number format used by the converterprimitive
-true
if the type is a float- Returns:
- Float converter with the provided numberFormat
-
fromInteger
- Parameters:
primitive
-true
if the type is a int- Returns:
- Integer converter for the default locale
-
fromInteger
- Parameters:
numberFormat
- number format used by the converterprimitive
-true
if the type is a int- Returns:
- Integer converter with the provided numberFormat
-
fromBigInteger
- Returns:
- BigInteger convert for the default locale
-
fromBigInteger
- Parameters:
numberFormat
- number format used by the converter- Returns:
- BigInteger converter with the provided numberFormat
-
fromBigDecimal
- Returns:
- BigDecimal convert for the default locale
-
fromBigDecimal
- Parameters:
numberFormat
- number format used by the converter- Returns:
- BigDecimal converter with the provided numberFormat
-
fromShort
- Parameters:
primitive
-true
if the type is a short- Returns:
- Short converter for the default locale
-
fromShort
- Parameters:
numberFormat
- number format used by the converterprimitive
-true
if the type is a short- Returns:
- Short converter with the provided numberFormat
-
fromByte
- Parameters:
primitive
-true
if the type is a byte- Returns:
- Byte converter for the default locale
-
fromByte
- Parameters:
numberFormat
- number format used by the converterprimitive
-true
if the type is a byte- Returns:
- Byte converter with the provided numberFormat
-