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 NumberToStringConverterstatic NumberToStringConverterfromBigDecimal(Format numberFormat) static NumberToStringConverterstatic NumberToStringConverterfromBigInteger(Format numberFormat) static NumberToStringConverterfromByte(boolean primitive) static NumberToStringConverterstatic NumberToStringConverterfromDouble(boolean primitive) static NumberToStringConverterfromDouble(Format numberFormat, boolean primitive) static NumberToStringConverterfromFloat(boolean primitive) static NumberToStringConverterstatic NumberToStringConverterfromInteger(boolean primitive) static NumberToStringConverterfromInteger(Format numberFormat, boolean primitive) static NumberToStringConverterfromLong(boolean primitive) static NumberToStringConverterstatic NumberToStringConverterfromShort(boolean primitive) static NumberToStringConverterMethods inherited from class org.eclipse.core.internal.databinding.conversion.AbstractNumberToStringConverter
convertMethods inherited from class org.eclipse.core.databinding.conversion.Converter
getFromType, getToType
-
Method Details
-
fromDouble
- Parameters:
primitive-trueif the type is a double- Returns:
- Double converter for the default locale
-
fromDouble
- Parameters:
numberFormat- number format used by the converterprimitive-trueif the type is a double- Returns:
- Double converter with the provided numberFormat
-
fromLong
- Parameters:
primitive-trueif the type is a long- Returns:
- Long converter for the default locale
-
fromLong
- Parameters:
numberFormat- number format used by the converterprimitive-trueif the type is a long- Returns:
- Long convert with the provided numberFormat
-
fromFloat
- Parameters:
primitive-trueif the type is a float- Returns:
- Float converter for the default locale
-
fromFloat
- Parameters:
numberFormat- number format used by the converterprimitive-trueif the type is a float- Returns:
- Float converter with the provided numberFormat
-
fromInteger
- Parameters:
primitive-trueif the type is a int- Returns:
- Integer converter for the default locale
-
fromInteger
- Parameters:
numberFormat- number format used by the converterprimitive-trueif 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-trueif the type is a short- Returns:
- Short converter for the default locale
-
fromShort
- Parameters:
numberFormat- number format used by the converterprimitive-trueif the type is a short- Returns:
- Short converter with the provided numberFormat
-
fromByte
- Parameters:
primitive-trueif the type is a byte- Returns:
- Byte converter for the default locale
-
fromByte
- Parameters:
numberFormat- number format used by the converterprimitive-trueif the type is a byte- Returns:
- Byte converter with the provided numberFormat
-