Class NumberFormatter

java.lang.Object
io.jmix.ui.component.formatter.NumberFormatter
All Implemented Interfaces:
Formatter<Number>, Function<Number,String>

@Component("ui_NumberFormatter") @Scope("prototype") public class NumberFormatter extends Object implements Formatter<Number>
Number formatter to be used in screen descriptors and controllers.

This formatter formats the Number value into a string depending on the format string.

  • Field Details

  • Constructor Details

    • NumberFormatter

      public NumberFormatter()
  • Method Details

    • setFormat

      @StudioProperty(type=LOCALIZED_STRING) public void setFormat(String format)
      Sets the format string describing the number format which will be used to create DecimalFormat instance. It can be either a format string, or a key in message group.
      Parameters:
      format - a format string or a key in message group
    • apply

      @Nullable public String apply(@Nullable Number value)
      Description copied from interface: Formatter
      Formats a value to a string.
      Specified by:
      apply in interface Formatter<Number>
      Specified by:
      apply in interface Function<Number,String>
      Parameters:
      value - a value
      Returns:
      formatted string