1/* GENERATED SOURCE. DO NOT MODIFY. */ 2// © 2017 and later: Unicode, Inc. and others. 3// License & terms of use: http://www.unicode.org/copyright.html#License 4package android.icu.number; 5 6import android.icu.util.Currency; 7 8/** 9 * A class that defines a rounding strategy parameterized by a currency to be used when formatting numbers in 10 * NumberFormatter. 11 * 12 * <p> 13 * To create a CurrencyRounder, use one of the factory methods on Rounder. 14 * 15 * @see NumberFormatter 16 * @hide Only a subset of ICU is exposed in Android 17 * @hide draft / provisional / internal are hidden on Android 18 */ 19public abstract class CurrencyRounder extends Rounder { 20 21 /* package-private */ CurrencyRounder() { 22 } 23 24 /** 25 * Associates a currency with this rounding strategy. 26 * 27 * <p> 28 * <strong>Calling this method is <em>not required</em></strong>, because the currency specified in unit() or via a 29 * CurrencyAmount passed into format(Measure) is automatically applied to currency rounding strategies. However, 30 * this method enables you to override that automatic association. 31 * 32 * <p> 33 * This method also enables numbers to be formatted using currency rounding rules without explicitly using a 34 * currency format. 35 * 36 * @param currency 37 * The currency to associate with this rounding strategy. 38 * @return A Rounder for chaining or passing to the NumberFormatter rounding() setter. 39 * @see NumberFormatter 40 * @hide draft / provisional / internal are hidden on Android 41 */ 42 public Rounder withCurrency(Currency currency) { 43 if (currency != null) { 44 return constructFromCurrency(this, currency); 45 } else { 46 throw new IllegalArgumentException("Currency must not be null"); 47 } 48 }; 49}