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.

Since:
1.9
  • Method Details

    • fromDouble

      public static NumberToStringConverter fromDouble(boolean primitive)
      Parameters:
      primitive - true if the type is a double
      Returns:
      Double converter for the default locale
    • fromDouble

      public static NumberToStringConverter fromDouble(Format numberFormat, boolean primitive)
      Parameters:
      numberFormat - number format used by the converter
      primitive - true if the type is a double
      Returns:
      Double converter with the provided numberFormat
    • fromLong

      public static NumberToStringConverter fromLong(boolean primitive)
      Parameters:
      primitive - true if the type is a long
      Returns:
      Long converter for the default locale
    • fromLong

      public static NumberToStringConverter fromLong(Format numberFormat, boolean primitive)
      Parameters:
      numberFormat - number format used by the converter
      primitive - true if the type is a long
      Returns:
      Long convert with the provided numberFormat
    • fromFloat

      public static NumberToStringConverter fromFloat(boolean primitive)
      Parameters:
      primitive - true if the type is a float
      Returns:
      Float converter for the default locale
    • fromFloat

      public static NumberToStringConverter fromFloat(Format numberFormat, boolean primitive)
      Parameters:
      numberFormat - number format used by the converter
      primitive - true if the type is a float
      Returns:
      Float converter with the provided numberFormat
    • fromInteger

      public static NumberToStringConverter fromInteger(boolean primitive)
      Parameters:
      primitive - true if the type is a int
      Returns:
      Integer converter for the default locale
    • fromInteger

      public static NumberToStringConverter fromInteger(Format numberFormat, boolean primitive)
      Parameters:
      numberFormat - number format used by the converter
      primitive - true if the type is a int
      Returns:
      Integer converter with the provided numberFormat
    • fromBigInteger

      public static NumberToStringConverter fromBigInteger()
      Returns:
      BigInteger convert for the default locale
    • fromBigInteger

      public static NumberToStringConverter fromBigInteger(Format numberFormat)
      Parameters:
      numberFormat - number format used by the converter
      Returns:
      BigInteger converter with the provided numberFormat
    • fromBigDecimal

      public static NumberToStringConverter fromBigDecimal()
      Returns:
      BigDecimal convert for the default locale
    • fromBigDecimal

      public static NumberToStringConverter fromBigDecimal(Format numberFormat)
      Parameters:
      numberFormat - number format used by the converter
      Returns:
      BigDecimal converter with the provided numberFormat
    • fromShort

      public static NumberToStringConverter fromShort(boolean primitive)
      Parameters:
      primitive - true if the type is a short
      Returns:
      Short converter for the default locale
    • fromShort

      public static NumberToStringConverter fromShort(Format numberFormat, boolean primitive)
      Parameters:
      numberFormat - number format used by the converter
      primitive - true if the type is a short
      Returns:
      Short converter with the provided numberFormat
    • fromByte

      public static NumberToStringConverter fromByte(boolean primitive)
      Parameters:
      primitive - true if the type is a byte
      Returns:
      Byte converter for the default locale
    • fromByte

      public static NumberToStringConverter fromByte(Format numberFormat, boolean primitive)
      Parameters:
      numberFormat - number format used by the converter
      primitive - true if the type is a byte
      Returns:
      Byte converter with the provided numberFormat