Java Code Examples for java.text.DecimalFormatSymbols#clone()

The following examples show how to use java.text.DecimalFormatSymbols#clone() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BtcFormat.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Set the currency symbol and international code of the underlying {@link
 * java.text.NumberFormat} object to the values of the last two arguments, respectively.
 * This method is invoked in the process of parsing, not formatting.
 * <p>
 * Only invoke this from code synchronized on value of the first argument, and don't
 * forget to put the symbols back otherwise equals(), hashCode() and immutability will
 * break.
 */
private static DecimalFormatSymbols setSymbolAndCode(DecimalFormat numberFormat, String symbol, String code) {
    checkState(Thread.holdsLock(numberFormat));
    DecimalFormatSymbols fs = numberFormat.getDecimalFormatSymbols();
    DecimalFormatSymbols ante = (DecimalFormatSymbols) fs.clone();
    fs.setInternationalCurrencySymbol(code);
    fs.setCurrencySymbol(symbol);
    numberFormat.setDecimalFormatSymbols(fs);
    return ante;
}
 
Example 2
Source File: BtcFormat.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
/** Set the currency symbol and international code of the underlying {@link
  * java.text.NumberFormat} object to the values of the last two arguments, respectively.
  * This method is invoked in the process of parsing, not formatting.
  *
  * Only invoke this from code synchronized on value of the first argument, and don't
  * forget to put the symbols back otherwise equals(), hashCode() and immutability will
  * break.  */
private static DecimalFormatSymbols setSymbolAndCode(DecimalFormat numberFormat, String symbol, String code) {
    checkState(Thread.holdsLock(numberFormat));
    DecimalFormatSymbols fs = numberFormat.getDecimalFormatSymbols();
    DecimalFormatSymbols ante = (DecimalFormatSymbols)fs.clone();
    fs.setInternationalCurrencySymbol(code);
    fs.setCurrencySymbol(symbol);
    numberFormat.setDecimalFormatSymbols(fs);
    return ante;
}
 
Example 3
Source File: BtcFormat.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
/** Set the currency symbol and international code of the underlying {@link
  * java.text.NumberFormat} object to the values of the last two arguments, respectively.
  * This method is invoked in the process of parsing, not formatting.
  *
  * Only invoke this from code synchronized on value of the first argument, and don't
  * forget to put the symbols back otherwise equals(), hashCode() and immutability will
  * break.  */
private static DecimalFormatSymbols setSymbolAndCode(DecimalFormat numberFormat, String symbol, String code) {
    checkState(Thread.holdsLock(numberFormat));
    DecimalFormatSymbols fs = numberFormat.getDecimalFormatSymbols();
    DecimalFormatSymbols ante = (DecimalFormatSymbols)fs.clone();
    fs.setInternationalCurrencySymbol(code);
    fs.setCurrencySymbol(symbol);
    numberFormat.setDecimalFormatSymbols(fs);
    return ante;
}