private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); pluralRulesWrapper = new PluralSelectorAdapter(); // Ignore the parsedValues from an earlier class version (before ICU 4.8) // and rebuild the msgPattern. parsedValues = null; if (pattern != null) { applyPattern(pattern); } } }
/** * Creates a new <code>PluralFormat</code> for a plural type, a * pattern and a locale. * @param ulocale the <code>PluralFormat</code> will be configured with * rules for this locale. This locale will also be used for standard * number formatting. * @param type The plural type (e.g., cardinal or ordinal). * @param pattern the pattern for this <code>PluralFormat</code>. * @param numberFormat The number formatter to use. * @throws IllegalArgumentException if the pattern is invalid. */ /*package*/ PluralFormat(ULocale ulocale, PluralType type, String pattern, NumberFormat numberFormat) { init(null, type, ulocale, numberFormat); applyPattern(pattern); }
/** * Creates a new <code>PluralFormat</code> for a plural type, a * pattern and a locale. * @param ulocale the <code>PluralFormat</code> will be configured with * rules for this locale. This locale will also be used for standard * number formatting. * @param type The plural type (e.g., cardinal or ordinal). * @param pattern the pattern for this <code>PluralFormat</code>. * @throws IllegalArgumentException if the pattern is invalid. * @stable ICU 50 */ public PluralFormat(ULocale ulocale, PluralType type, String pattern) { init(null, type, ulocale, null); applyPattern(pattern); }
/** * Creates a new cardinal-number <code>PluralFormat</code> for a given set of rules, a * pattern and a locale. * @param ulocale the <code>PluralFormat</code> will be configured with * rules for this locale. This locale will also be used for standard * number formatting. * @param rules defines the behavior of the <code>PluralFormat</code> * object. * @param pattern the pattern for this <code>PluralFormat</code>. * @throws IllegalArgumentException if the pattern is invalid. * @stable ICU 3.8 */ public PluralFormat(ULocale ulocale, PluralRules rules, String pattern) { init(rules, PluralType.CARDINAL, ulocale, null); applyPattern(pattern); }
/** * Creates a new cardinal-number <code>PluralFormat</code> for a given pattern string and * locale. * The locale will be used to get the set of plural rules and for * standard number formatting. * <p>Example code:{@.jcite com.ibm.icu.samples.text.pluralformat.PluralFormatSample:---PluralFormatExample} * @param ulocale the <code>PluralFormat</code> will be configured with * rules for this locale. This locale will also be used for standard * number formatting. * @param pattern the pattern for this <code>PluralFormat</code>. * @throws IllegalArgumentException if the pattern is invalid. * @stable ICU 3.8 */ public PluralFormat(ULocale ulocale, String pattern) { init(null, PluralType.CARDINAL, ulocale, null); applyPattern(pattern); }
/** * Creates a new cardinal-number <code>PluralFormat</code> for a given pattern string. * The default <code>FORMAT</code> locale will be used to get the set of plural rules and for * standard number formatting. * @param pattern the pattern for this <code>PluralFormat</code>. * @throws IllegalArgumentException if the pattern is invalid. * @see Category#FORMAT * @stable ICU 3.8 */ public PluralFormat(String pattern) { init(null, PluralType.CARDINAL, ULocale.getDefault(Category.FORMAT), null); applyPattern(pattern); }
/** * Creates a new cardinal-number <code>PluralFormat</code> for a given set of rules and a * pattern. * The standard number formatting will be done using the default <code>FORMAT</code> locale. * @param rules defines the behavior of the <code>PluralFormat</code> * object. * @param pattern the pattern for this <code>PluralFormat</code>. * @throws IllegalArgumentException if the pattern is invalid. * @see Category#FORMAT * @stable ICU 3.8 */ public PluralFormat(PluralRules rules, String pattern) { init(rules, PluralType.CARDINAL, ULocale.getDefault(Category.FORMAT), null); applyPattern(pattern); }