Interface PluralRule


public interface PluralRule
The interface that plural rules must implement. Implementations of this interface will be used both at compile time (pluralForms) and at run time (select), so implementations must be both translatable and not reference JSNI methods.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Information about the plural forms supported by this rule which will be used during code generation and by tools to provide information to translators.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the list of values which are valid for this rule.
    int
    select(int n)
    Returns the plural form appropriate for this count.
  • Method Details

    • pluralForms

      PluralRule.PluralForm[] pluralForms()
      Returns the list of values which are valid for this rule. The default or "other" plural form must be first in the list with an index of 0 -- this form will be used if no other form applies and is also mapped to the default text for a given message. This method will be executed at compile time and may not contain any references, even indirectly, to JSNI methods.
    • select

      int select(int n)
      Returns the plural form appropriate for this count. This method will be executed at runtime, so must be translatable.
      Parameters:
      n - count of items to choose plural form for
      Returns:
      the plural form to use (must be a valid index into the array returned by pluralForms).