2 *******************************************************************************
3 * Copyright (C) 2008, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
7 package com.ibm.icu.impl.jdkadapter;
9 import java.util.Currency;
11 import com.ibm.icu.text.DecimalFormatSymbols;
14 * DecimalFormatSymbolsICU is an adapter class which wraps ICU4J DecimalFormatSymbols and
15 * implements java.text.DecimalFormatSymbols APIs.
17 public class DecimalFormatSymbolsICU extends java.text.DecimalFormatSymbols {
19 private static final long serialVersionUID = -8226875908479009580L;
21 private DecimalFormatSymbols fIcuDecfs;
23 private DecimalFormatSymbolsICU(DecimalFormatSymbols icuDecfs) {
27 public static java.text.DecimalFormatSymbols wrap(DecimalFormatSymbols icuDecfs) {
28 return new DecimalFormatSymbolsICU(icuDecfs);
31 public DecimalFormatSymbols unwrap() {
36 public Object clone() {
37 DecimalFormatSymbolsICU other = (DecimalFormatSymbolsICU)super.clone();
38 other.fIcuDecfs = (DecimalFormatSymbols)fIcuDecfs.clone();
43 public boolean equals(Object obj) {
44 if (obj instanceof DecimalFormatSymbolsICU) {
45 return ((DecimalFormatSymbolsICU)obj).fIcuDecfs.equals(fIcuDecfs);
51 public Currency getCurrency() {
52 com.ibm.icu.util.Currency icuCurrency = fIcuDecfs.getCurrency();
53 if (icuCurrency == null) {
56 return Currency.getInstance(icuCurrency.getCurrencyCode());
60 public String getCurrencySymbol() {
61 return fIcuDecfs.getCurrencySymbol();
65 public char getDecimalSeparator() {
66 return fIcuDecfs.getDecimalSeparator();
70 public char getDigit() {
71 return fIcuDecfs.getDigit();
75 public String getExponentSeparator() {
76 return fIcuDecfs.getExponentSeparator();
80 public char getGroupingSeparator() {
81 return fIcuDecfs.getGroupingSeparator();
85 public String getInfinity() {
86 return fIcuDecfs.getInfinity();
90 public String getInternationalCurrencySymbol() {
91 return fIcuDecfs.getInternationalCurrencySymbol();
95 public char getMinusSign() {
96 return fIcuDecfs.getMinusSign();
100 public char getMonetaryDecimalSeparator() {
101 return fIcuDecfs.getMonetaryDecimalSeparator();
105 public String getNaN() {
106 return fIcuDecfs.getNaN();
110 public char getPatternSeparator() {
111 return fIcuDecfs.getPatternSeparator();
115 public char getPercent() {
116 return fIcuDecfs.getPercent();
120 public char getPerMill() {
121 return fIcuDecfs.getPerMill();
125 public char getZeroDigit() {
126 return fIcuDecfs.getZeroDigit();
130 public void setCurrency(Currency currency) {
131 com.ibm.icu.util.Currency icuCurrency = null;
132 if (currency != null) {
133 icuCurrency = com.ibm.icu.util.Currency.getInstance(currency.getCurrencyCode());
135 fIcuDecfs.setCurrency(icuCurrency);
139 public void setCurrencySymbol(String currency) {
140 fIcuDecfs.setCurrencySymbol(currency);
144 public void setDecimalSeparator(char decimalSeparator) {
145 fIcuDecfs.setDecimalSeparator(decimalSeparator);
149 public void setDigit(char digit) {
150 fIcuDecfs.setDigit(digit);
154 public void setExponentSeparator(String exp) {
155 fIcuDecfs.setExponentSeparator(exp);
159 public void setGroupingSeparator(char groupingSeparator) {
160 fIcuDecfs.setGroupingSeparator(groupingSeparator);
164 public void setInfinity(String infinity) {
165 fIcuDecfs.setInfinity(infinity);
169 public void setInternationalCurrencySymbol(String currencyCode) {
170 fIcuDecfs.setInternationalCurrencySymbol(currencyCode);
174 public void setMinusSign(char minusSign) {
175 fIcuDecfs.setMinusSign(minusSign);
179 public void setMonetaryDecimalSeparator(char sep) {
180 fIcuDecfs.setMonetaryDecimalSeparator(sep);
184 public void setNaN(String NaN) {
185 fIcuDecfs.setNaN(NaN);
189 public void setPatternSeparator(char patternSeparator) {
190 fIcuDecfs.setPatternSeparator(patternSeparator);
194 public void setPercent(char percent) {
195 fIcuDecfs.setPercent(percent);
199 public void setPerMill(char perMill) {
200 fIcuDecfs.setPerMill(perMill);
204 public void setZeroDigit(char zeroDigit) {
205 fIcuDecfs.setZeroDigit(zeroDigit);
209 public int hashCode() {
210 return fIcuDecfs.hashCode();