ICU-8399 Rmoved Currecny.getLocale()/setLocale() as planned (long time ago).

X-SVN-Rev: 29684
This commit is contained in:
Yoshito Umaoka 2011-03-22 17:38:46 +00:00
parent 934d73b4ea
commit de15fc869d
3 changed files with 3 additions and 85 deletions

View File

@ -1,6 +1,6 @@
/**
*******************************************************************************
* Copyright (C) 2001-2010, International Business Machines Corporation and *
* Copyright (C) 2001-2011, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -802,81 +802,5 @@ public class Currency extends MeasureUnit implements Serializable {
List<String> allActive = info.currencies(CurrencyFilter.onRange(from, to));
return allActive.contains(code);
}
// -------- BEGIN ULocale boilerplate --------
/**
* Return the locale that was used to create this object, or null.
* This may may differ from the locale requested at the time of
* this object's creation. For example, if an object is created
* for locale <tt>en_US_CALIFORNIA</tt>, the actual data may be
* drawn from <tt>en</tt> (the <i>actual</i> locale), and
* <tt>en_US</tt> may be the most specific locale that exists (the
* <i>valid</i> locale).
*
* <p>Note: This method will be obsoleted. The implementation is
* no longer locale-specific and so there is no longer a valid or
* actual locale associated with the Currency object. Until
* it is removed, this method will return the root locale.
* @param type type of information requested, either {@link
* com.ibm.icu.util.ULocale#VALID_LOCALE} or {@link
* com.ibm.icu.util.ULocale#ACTUAL_LOCALE}.
* @return the information specified by <i>type</i>, or null if
* this object was not constructed from locale data.
* @see com.ibm.icu.util.ULocale
* @see com.ibm.icu.util.ULocale#VALID_LOCALE
* @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE
* @obsolete ICU 3.2 to be removed
* @deprecated This API is obsolete.
*/
public final ULocale getLocale(ULocale.Type type) {
ULocale result = (type == ULocale.ACTUAL_LOCALE) ? actualLocale : validLocale;
if (result == null) {
return ULocale.ROOT;
}
return result;
}
/**
* Set information about the locales that were used to create this
* object. If the object was not constructed from locale data,
* both arguments should be set to null. Otherwise, neither
* should be null. The actual locale must be at the same level or
* less specific than the valid locale. This method is intended
* for use by factories or other entities that create objects of
* this class.
* @param valid the most specific locale containing any resource
* data, or null
* @param actual the locale containing data used to construct this
* object, or null
* @see com.ibm.icu.util.ULocale
* @see com.ibm.icu.util.ULocale#VALID_LOCALE
* @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE
*/
final void setLocale(ULocale valid, ULocale actual) {
// Change the following to an assertion later
if ((valid == null) != (actual == null)) {
///CLOVER:OFF
throw new IllegalArgumentException();
///CLOVER:ON
}
// Another check we could do is that the actual locale is at
// the same level or less specific than the valid locale.
this.validLocale = valid;
this.actualLocale = actual;
}
/*
* The most specific locale containing any resource data, or null.
*/
private ULocale validLocale;
/*
* The locale containing data used to construct this object, or null.
*/
private ULocale actualLocale;
// -------- END ULocale boilerplate --------
}
//eof

View File

@ -1,6 +1,6 @@
/**
*******************************************************************************
* Copyright (C) 2001-2010, International Business Machines Corporation and *
* Copyright (C) 2001-2011, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -42,10 +42,7 @@ final class CurrencyServiceShim extends Currency.ServiceShim {
if (service.isDefault()) {
return Currency.createCurrency(loc);
}
ULocale[] actualLoc = new ULocale[1];
Currency curr = (Currency)service.get(loc, actualLoc);
ULocale uloc = actualLoc[0];
curr.setLocale(uloc, uloc); // services make no distinction between actual & valid
Currency curr = (Currency)service.get(loc);
return curr;
}

View File

@ -200,9 +200,6 @@ public class CurrencyTest extends TestFmwk {
"$",
usd.getSymbol());
}
assertEquals("USD.getLocale()",
ULocale.ROOT,
usd.getLocale(null));
}
// Provide better code coverage for the CurrencyDisplayNames class