Class PluralFormat
- java.lang.Object
-
- com.vmware.vipclient.i18n.l2.text.PluralFormat
-
public class PluralFormat extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description PluralFormat(java.lang.String pattern)PluralFormat(java.util.Locale locale, java.lang.String pattern)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyPattern(java.lang.String pattern)Sets the pattern used by this plural format.java.lang.Stringformat(double number)java.lang.StringBuilderformat(java.lang.Object number, java.lang.StringBuilder toAppendTo, java.text.FieldPosition pos)Formats a plural message for a given number and appends the formatted message to the givenStringBuffer.
-
-
-
Method Detail
-
applyPattern
public void applyPattern(java.lang.String pattern)
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:
java.lang.IllegalArgumentException- if the pattern is invalid.
-
format
public final java.lang.String format(double number)
-
format
public java.lang.StringBuilder format(java.lang.Object number, java.lang.StringBuilder toAppendTo, java.text.FieldPosition pos)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:
java.lang.IllegalArgumentException- if number is not an instance of Number
-
-