Class StringToNumberConverter<T extends Number>
java.lang.Object
org.eclipse.core.databinding.conversion.Converter<F,T>
org.eclipse.core.internal.databinding.validation.NumberFormatConverter<Object,T>
org.eclipse.core.internal.databinding.conversion.AbstractStringToNumberConverter<T>
org.eclipse.core.databinding.conversion.StringToNumberConverter<T>
- Type Parameters:
T
- The type to which values are converted.
- All Implemented Interfaces:
IConverter<Object,
T>
@Deprecated(forRemoval=true)
public class StringToNumberConverter<T extends Number>
extends org.eclipse.core.internal.databinding.conversion.AbstractStringToNumberConverter<T>
Deprecated, for removal: This API element is subject to removal in a future version.
Converts a String to a Number using
NumberFormat.parse(...)
.
This class is thread safe.
Note that this class does not have precise type parameters because it
manually handles argument type mismatches and throws
IllegalArgumentException
.
The first type parameter of NumberFormatConverter
is set to
Object
to preserve backwards compatibility, but the argument is meant
to always be a String
.- Since:
- 1.0
- Restriction:
- This class is not intended to be subclassed by clients.
- Restriction:
- This class is not intended to be referenced by clients.
-
Field Summary
Fields inherited from class org.eclipse.core.internal.databinding.conversion.AbstractStringToNumberConverter
MAX_BYTE, MAX_DOUBLE, MAX_FLOAT, MAX_INTEGER, MAX_LONG, MAX_SHORT, MIN_BYTE, MIN_DOUBLE, MIN_FLOAT, MIN_INTEGER, MIN_LONG, MIN_SHORT
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Converts the providedfromObject
to the requestedto type
.static StringToNumberConverter<BigDecimal>
Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<BigDecimal>
toBigDecimal
(com.ibm.icu.text.NumberFormat numberFormat) Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<BigInteger>
Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<BigInteger>
toBigInteger
(com.ibm.icu.text.NumberFormat numberFormat) Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<Byte>
toByte
(boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<Byte>
toByte
(com.ibm.icu.text.NumberFormat numberFormat, boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<Double>
toDouble
(boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<Double>
toDouble
(com.ibm.icu.text.NumberFormat numberFormat, boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<Float>
toFloat
(boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<Float>
toFloat
(com.ibm.icu.text.NumberFormat numberFormat, boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<Integer>
toInteger
(boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<Integer>
toInteger
(com.ibm.icu.text.NumberFormat numberFormat, boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<Long>
toLong
(boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<Long>
toLong
(com.ibm.icu.text.NumberFormat numberFormat, boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<Short>
toShort
(boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.static StringToNumberConverter<Short>
toShort
(com.ibm.icu.text.NumberFormat numberFormat, boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class org.eclipse.core.databinding.conversion.Converter
getFromType, getToType
-
Method Details
-
convert
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:org.eclipse.core.internal.databinding.conversion.AbstractStringToNumberConverter
Converts the providedfromObject
to the requestedto type
.- Specified by:
convert
in interfaceIConverter<Object,
T extends Number> - Overrides:
convert
in classorg.eclipse.core.internal.databinding.conversion.AbstractStringToNumberConverter<T extends Number>
- Parameters:
fromObject
- the object to convert, of typeIConverter.getFromType()
- Returns:
- the converted object, of type
IConverter.getToType()
- See Also:
- Implementation Note:
- Overridden to avoid API tooling problem.
-
toInteger
Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
primitive
-true
if the convert to type is an int- Returns:
- to Integer converter for the default locale
-
toInteger
public static StringToNumberConverter<Integer> toInteger(com.ibm.icu.text.NumberFormat numberFormat, boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
numberFormat
- number format used by the converterprimitive
-true
if the convert to type is an int- Returns:
- to Integer converter with the provided numberFormat
-
toDouble
Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
primitive
-true
if the convert to type is a double- Returns:
- to Double converter for the default locale
-
toDouble
public static StringToNumberConverter<Double> toDouble(com.ibm.icu.text.NumberFormat numberFormat, boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
numberFormat
- number format used by the converterprimitive
-true
if the convert to type is a double- Returns:
- to Double converter with the provided numberFormat
-
toLong
Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
primitive
-true
if the convert to type is a long- Returns:
- to Long converter for the default locale
-
toLong
public static StringToNumberConverter<Long> toLong(com.ibm.icu.text.NumberFormat numberFormat, boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
numberFormat
- number format used by the converterprimitive
-true
if the convert to type is a long- Returns:
- to Long converter with the provided numberFormat
-
toFloat
Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
primitive
-true
if the convert to type is a float- Returns:
- to Float converter for the default locale
-
toFloat
public static StringToNumberConverter<Float> toFloat(com.ibm.icu.text.NumberFormat numberFormat, boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
numberFormat
- number format used by the converterprimitive
-true
if the convert to type is a float- Returns:
- to Float converter with the provided numberFormat
-
toBigInteger
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- to BigInteger converter for the default locale
-
toBigInteger
public static StringToNumberConverter<BigInteger> toBigInteger(com.ibm.icu.text.NumberFormat numberFormat) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
numberFormat
- number format used by the converter- Returns:
- to BigInteger converter with the provided numberFormat
-
toBigDecimal
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- to BigDecimal converter for the default locale
- Since:
- 1.2
-
toBigDecimal
public static StringToNumberConverter<BigDecimal> toBigDecimal(com.ibm.icu.text.NumberFormat numberFormat) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
numberFormat
- number format used by the converter- Returns:
- to BigDecimal converter with the provided numberFormat
- Since:
- 1.2
-
toShort
Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
primitive
-true
if the convert to type is a short- Returns:
- to Short converter for the default locale
- Since:
- 1.2
-
toShort
public static StringToNumberConverter<Short> toShort(com.ibm.icu.text.NumberFormat numberFormat, boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
numberFormat
- number format used by the converterprimitive
-true
if the convert to type is a short- Returns:
- to Short converter with the provided numberFormat
- Since:
- 1.2
-
toByte
Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
primitive
-true
if the convert to type is a byte- Returns:
- to Byte converter for the default locale
- Since:
- 1.2
-
toByte
public static StringToNumberConverter<Byte> toByte(com.ibm.icu.text.NumberFormat numberFormat, boolean primitive) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
numberFormat
- number format used by the converterprimitive
-true
if the convert to type is a byte- Returns:
- to Byte converter with the provided numberFormat
- Since:
- 1.2
-
StringToNumberConverter
instead, which does not usecom.ibm.icu
as that package is planned to be removed in the future from platform.