Class NumberFunctionFactory.NumberFunctionImpl

java.lang.Object
com.ibm.icu.message2.NumberFunctionFactory.NumberFunctionImpl
All Implemented Interfaces:
Function
Enclosing class:
NumberFunctionFactory

static class NumberFunctionFactory.NumberFunctionImpl extends Object implements Function
  • Field Details

  • Constructor Details

  • Method Details

    • getIcuFormatter

      LocalizedNumberFormatter getIcuFormatter()
    • formatToString

      public String formatToString(Object toFormat, Map<String,Object> variableOptions)
      A method that takes the object to format and returns the i18n-aware string representation.
      Specified by:
      formatToString in interface Function
      Parameters:
      toFormat - the object to format.
      variableOptions - options that are not know at build time.
      Returns:
      the formatted string.
    • format

      public FormattedPlaceholder format(Object toFormat, Map<String,Object> variableOptions)
      A method that takes the object to format and returns the i18n-aware formatted placeholder.
      Specified by:
      format in interface Function
      Parameters:
      toFormat - the object to format.
      variableOptions - options that are not know at build time.
      Returns:
      the formatted placeholder.
    • matches

      public List<String> matches(Object value, List<String> keys, Map<String,Object> variableOptions)
      A method that is invoked for the object to match on each key.

      For example, an English plural matches would return true for matches(1, "1"), matches(1, "one"), and matches(1, "*").

      Specified by:
      matches in interface Function
      Parameters:
      value - the value to select on.
      keys - the key to test for matching.
      variableOptions - options that are not know at build time.
      Returns:
      the formatted string.
    • pluralComparator

      private static int pluralComparator(String o1, String o2)
    • matches

      private boolean matches(Object value, String key, Map<String,Object> variableOptions)
    • resolveValue

      private Number resolveValue(Object toFormat, Map<String,Object> variableOptions)