ICU-9420 move ListFormatter to the .text package, add getInstance(no locale)
X-SVN-Rev: 32178
This commit is contained in:
parent
527161ff5a
commit
f30b743eff
@ -4,7 +4,7 @@
|
||||
* others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.util;
|
||||
package com.ibm.icu.text;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -13,11 +13,13 @@ import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ibm.icu.util.ULocale;
|
||||
|
||||
/**
|
||||
* Immutable class for formatting a list, using data from CLDR (or supplied
|
||||
* separately). The class is not subclassable.
|
||||
*
|
||||
* @author markdavis
|
||||
* @author Mark Davis
|
||||
* @draft ICU 50
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
@ -88,6 +90,17 @@ final public class ListFormatter {
|
||||
return getInstance(ULocale.forLocale(locale));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a list formatter that is appropriate for the default FORMAT locale.
|
||||
*
|
||||
* @return ListFormatter
|
||||
* @draft ICU 50
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public static ListFormatter getInstance() {
|
||||
return getInstance(ULocale.getDefault(ULocale.Category.FORMAT));
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a list of objects.
|
||||
*
|
@ -4,7 +4,7 @@
|
||||
* others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.util;
|
||||
package com.ibm.icu.text;
|
||||
|
||||
class ListFormatterData {
|
||||
static void load() {
|
@ -1,13 +1,15 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2012-2012, Google, International Business Machines Corporation and
|
||||
* others. All Rights Reserved. *
|
||||
* others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.dev.test.util;
|
||||
package com.ibm.icu.dev.test.format;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.util.ListFormatter;
|
||||
import com.ibm.icu.text.ListFormatter;
|
||||
import com.ibm.icu.util.ULocale;
|
||||
|
||||
public class ListFormatterTest extends TestFmwk {
|
||||
@ -41,6 +43,12 @@ public class ListFormatterTest extends TestFmwk {
|
||||
public void TestEnglish() {
|
||||
checkData(ListFormatter.getInstance(ULocale.ENGLISH), EnglishTestData);
|
||||
checkData(ListFormatter.getInstance(ULocale.US), EnglishTestData);
|
||||
// Redundant tests for code coverage.
|
||||
checkData(ListFormatter.getInstance(Locale.ENGLISH), EnglishTestData);
|
||||
ULocale defaultLocale = ULocale.getDefault(ULocale.Category.FORMAT);
|
||||
if (defaultLocale.equals(ULocale.ENGLISH) || defaultLocale.equals(ULocale.US)) {
|
||||
checkData(ListFormatter.getInstance(), EnglishTestData);
|
||||
}
|
||||
}
|
||||
|
||||
String[] JapaneseTestData = {
|
@ -28,6 +28,7 @@ public class TestAll extends TestGroup {
|
||||
"TestAll$TimeUnitFormat",
|
||||
"com.ibm.icu.dev.test.format.BigNumberFormatTest",
|
||||
"DataDrivenFormatTest",
|
||||
"ListFormatterTest",
|
||||
"TestAll$PluralFormat",
|
||||
"TestAll$MessageFormat",
|
||||
"TestAll$SelectFormat"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2012, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
* Copyright (C) 1996-2012, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.dev.test.util;
|
||||
@ -31,7 +31,6 @@ public class TestAll extends TestGroup {
|
||||
"Trie2Test",
|
||||
"LocaleDataTest",
|
||||
"GenderInfoTest",
|
||||
"ListFormatterTest",
|
||||
"ULocaleTest",
|
||||
"LocaleAliasTest",
|
||||
"DebugUtilitiesTest",
|
||||
@ -45,5 +44,3 @@ public class TestAll extends TestGroup {
|
||||
|
||||
public static final String CLASS_TARGET_NAME = "Util";
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user