Class PluralFormat
java.lang.Object
com.vmware.vipclient.i18n.l2.text.PluralFormat
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyPattern(String pattern) Sets the pattern used by this plural format.final Stringformat(double number) format(Object number, StringBuilder toAppendTo, FieldPosition pos) Formats a plural message for a given number and appends the formatted message to the givenStringBuffer.
-
Constructor Details
-
PluralFormat
-
PluralFormat
-
-
Method Details
-
applyPattern
Sets the pattern used by this plural format. The method parses the pattern and creates a map of format strings for the plural rules. Patterns and their interpretation are specified in the class description.- Parameters:
pattern- the pattern for this plural format.- Throws:
IllegalArgumentException- if the pattern is invalid.
-
format
-
format
Formats a plural message for a given number and appends the formatted message to the givenStringBuffer.- Parameters:
number- a number object (instance ofNumberfor which the plural message should be formatted. If no pattern has been applied to thisPluralFormatobject yet, the formatted number will be returned. Note: If this object is not an instance ofNumber, thetoAppendTowill not be modified.toAppendTo- the formatted message will be appended to thisStringBuffer.pos- will be ignored by this method.- Returns:
- the string buffer passed in as toAppendTo, with formatted text appended.
- Throws:
IllegalArgumentException- if number is not an instance of Number
-