All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ibm.icu.number.CurrencyRounder Maven / Gradle / Ivy

There is a newer version: 2.12.15
Show newest version
// © 2017 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
package com.ibm.icu.number;

import com.ibm.icu.util.Currency;

/**
 * A class that defines a rounding strategy parameterized by a currency to be used when formatting
 * numbers in NumberFormatter.
 *
 * 

* To create a CurrencyRounder, use one of the factory methods on Rounder. * * @draft ICU 60 * @provisional This API might change or be removed in a future release. * @see NumberFormatter */ public abstract class CurrencyRounder extends Rounder { /* package-private */ CurrencyRounder() { } /** * Associates a currency with this rounding strategy. * *

* Calling this method is not required, because the currency specified in * unit() or via a CurrencyAmount passed into format(Measure) is automatically applied to currency * rounding strategies. However, this method enables you to override that automatic association. * *

* This method also enables numbers to be formatted using currency rounding rules without explicitly * using a currency format. * * @param currency * The currency to associate with this rounding strategy. * @return A Rounder for chaining or passing to the NumberFormatter rounding() setter. * @draft ICU 60 * @provisional This API might change or be removed in a future release. * @see NumberFormatter */ public Rounder withCurrency(Currency currency) { if (currency != null) { return constructFromCurrency(this, currency); } else { throw new IllegalArgumentException("Currency must not be null"); } }; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy