提交 8cceef90 编写于 作者: N naoto

7092447: Clarify the default locale used in each locale sensitive operation

Reviewed-by: okutsu
上级 4b97b169
...@@ -439,7 +439,12 @@ public abstract class DateFormat extends Format { ...@@ -439,7 +439,12 @@ public abstract class DateFormat extends Format {
/** /**
* Gets the time formatter with the default formatting style * Gets the time formatter with the default formatting style
* for the default locale. * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* <p>This is equivalent to calling
* {@link #getTimeInstance(int, Locale) getTimeInstance(DEFAULT,
* Locale.getDefault(Locale.Category.FORMAT))}.
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @return a time formatter. * @return a time formatter.
*/ */
public final static DateFormat getTimeInstance() public final static DateFormat getTimeInstance()
...@@ -449,7 +454,12 @@ public abstract class DateFormat extends Format { ...@@ -449,7 +454,12 @@ public abstract class DateFormat extends Format {
/** /**
* Gets the time formatter with the given formatting style * Gets the time formatter with the given formatting style
* for the default locale. * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* <p>This is equivalent to calling
* {@link #getTimeInstance(int, Locale) getTimeInstance(style,
* Locale.getDefault(Locale.Category.FORMAT))}.
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @param style the given formatting style. For example, * @param style the given formatting style. For example,
* SHORT for "h:mm a" in the US locale. * SHORT for "h:mm a" in the US locale.
* @return a time formatter. * @return a time formatter.
...@@ -475,7 +485,12 @@ public abstract class DateFormat extends Format { ...@@ -475,7 +485,12 @@ public abstract class DateFormat extends Format {
/** /**
* Gets the date formatter with the default formatting style * Gets the date formatter with the default formatting style
* for the default locale. * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* <p>This is equivalent to calling
* {@link #getDateInstance(int, Locale) getDateInstance(DEFAULT,
* Locale.getDefault(Locale.Category.FORMAT))}.
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @return a date formatter. * @return a date formatter.
*/ */
public final static DateFormat getDateInstance() public final static DateFormat getDateInstance()
...@@ -485,7 +500,12 @@ public abstract class DateFormat extends Format { ...@@ -485,7 +500,12 @@ public abstract class DateFormat extends Format {
/** /**
* Gets the date formatter with the given formatting style * Gets the date formatter with the given formatting style
* for the default locale. * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* <p>This is equivalent to calling
* {@link #getDateInstance(int, Locale) getDateInstance(style,
* Locale.getDefault(Locale.Category.FORMAT))}.
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @param style the given formatting style. For example, * @param style the given formatting style. For example,
* SHORT for "M/d/yy" in the US locale. * SHORT for "M/d/yy" in the US locale.
* @return a date formatter. * @return a date formatter.
...@@ -511,7 +531,12 @@ public abstract class DateFormat extends Format { ...@@ -511,7 +531,12 @@ public abstract class DateFormat extends Format {
/** /**
* Gets the date/time formatter with the default formatting style * Gets the date/time formatter with the default formatting style
* for the default locale. * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* <p>This is equivalent to calling
* {@link #getDateTimeInstance(int, int, Locale) getDateTimeInstance(DEFAULT,
* DEFAULT, Locale.getDefault(Locale.Category.FORMAT))}.
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @return a date/time formatter. * @return a date/time formatter.
*/ */
public final static DateFormat getDateTimeInstance() public final static DateFormat getDateTimeInstance()
...@@ -521,7 +546,12 @@ public abstract class DateFormat extends Format { ...@@ -521,7 +546,12 @@ public abstract class DateFormat extends Format {
/** /**
* Gets the date/time formatter with the given date and time * Gets the date/time formatter with the given date and time
* formatting styles for the default locale. * formatting styles for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* <p>This is equivalent to calling
* {@link #getDateTimeInstance(int, int, Locale) getDateTimeInstance(dateStyle,
* timeStyle, Locale.getDefault(Locale.Category.FORMAT))}.
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @param dateStyle the given date formatting style. For example, * @param dateStyle the given date formatting style. For example,
* SHORT for "M/d/yy" in the US locale. * SHORT for "M/d/yy" in the US locale.
* @param timeStyle the given time formatting style. For example, * @param timeStyle the given time formatting style. For example,
......
...@@ -104,14 +104,19 @@ public class DateFormatSymbols implements Serializable, Cloneable { ...@@ -104,14 +104,19 @@ public class DateFormatSymbols implements Serializable, Cloneable {
/** /**
* Construct a DateFormatSymbols object by loading format data from * Construct a DateFormatSymbols object by loading format data from
* resources for the default locale. This constructor can only * resources for the default {@link java.util.Locale.Category#FORMAT FORMAT}
* locale. This constructor can only
* construct instances for the locales supported by the Java * construct instances for the locales supported by the Java
* runtime environment, not for those supported by installed * runtime environment, not for those supported by installed
* {@link java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider} * {@link java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider}
* implementations. For full locale coverage, use the * implementations. For full locale coverage, use the
* {@link #getInstance(Locale) getInstance} method. * {@link #getInstance(Locale) getInstance} method.
* * <p>This is equivalent to calling
* {@link #DateFormatSymbols(Locale)
* DateFormatSymbols(Locale.getDefault(Locale.Category.FORMAT))}.
* @see #getInstance() * @see #getInstance()
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @exception java.util.MissingResourceException * @exception java.util.MissingResourceException
* if the resources for the default locale cannot be * if the resources for the default locale cannot be
* found or cannot be loaded. * found or cannot be loaded.
...@@ -302,6 +307,10 @@ public class DateFormatSymbols implements Serializable, Cloneable { ...@@ -302,6 +307,10 @@ public class DateFormatSymbols implements Serializable, Cloneable {
* as for those supported by installed * as for those supported by installed
* {@link java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider} * {@link java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider}
* implementations. * implementations.
* <p>This is equivalent to calling {@link #getInstance(Locale)
* getInstance(Locale.getDefault(Locale.Category.FORMAT))}.
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @return a <code>DateFormatSymbols</code> instance. * @return a <code>DateFormatSymbols</code> instance.
* @since 1.6 * @since 1.6
*/ */
......
...@@ -381,7 +381,8 @@ public class DecimalFormat extends NumberFormat { ...@@ -381,7 +381,8 @@ public class DecimalFormat extends NumberFormat {
/** /**
* Creates a DecimalFormat using the default pattern and symbols * Creates a DecimalFormat using the default pattern and symbols
* for the default locale. This is a convenient way to obtain a * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* This is a convenient way to obtain a
* DecimalFormat when internationalization is not the main concern. * DecimalFormat when internationalization is not the main concern.
* <p> * <p>
* To obtain standard formats for a given locale, use the factory methods * To obtain standard formats for a given locale, use the factory methods
...@@ -411,7 +412,8 @@ public class DecimalFormat extends NumberFormat { ...@@ -411,7 +412,8 @@ public class DecimalFormat extends NumberFormat {
/** /**
* Creates a DecimalFormat using the given pattern and the symbols * Creates a DecimalFormat using the given pattern and the symbols
* for the default locale. This is a convenient way to obtain a * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* This is a convenient way to obtain a
* DecimalFormat when internationalization is not the main concern. * DecimalFormat when internationalization is not the main concern.
* <p> * <p>
* To obtain standard formats for a given locale, use the factory methods * To obtain standard formats for a given locale, use the factory methods
......
...@@ -71,13 +71,19 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; ...@@ -71,13 +71,19 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
public class DecimalFormatSymbols implements Cloneable, Serializable { public class DecimalFormatSymbols implements Cloneable, Serializable {
/** /**
* Create a DecimalFormatSymbols object for the default locale. * Create a DecimalFormatSymbols object for the default
* {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* This constructor can only construct instances for the locales * This constructor can only construct instances for the locales
* supported by the Java runtime environment, not for those * supported by the Java runtime environment, not for those
* supported by installed * supported by installed
* {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider} * {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider}
* implementations. For full locale coverage, use the * implementations. For full locale coverage, use the
* {@link #getInstance(Locale) getInstance} method. * {@link #getInstance(Locale) getInstance} method.
* <p>This is equivalent to calling
* {@link #DecimalFormatSymbols(Locale)
* DecimalFormatSymbols(Locale.getDefault(Locale.Category.FORMAT))}.
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
*/ */
public DecimalFormatSymbols() { public DecimalFormatSymbols() {
initialize( Locale.getDefault(Locale.Category.FORMAT) ); initialize( Locale.getDefault(Locale.Category.FORMAT) );
...@@ -133,6 +139,11 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { ...@@ -133,6 +139,11 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
* as for those supported by installed * as for those supported by installed
* {@link java.text.spi.DecimalFormatSymbolsProvider * {@link java.text.spi.DecimalFormatSymbolsProvider
* DecimalFormatSymbolsProvider} implementations. * DecimalFormatSymbolsProvider} implementations.
* <p>This is equivalent to calling
* {@link #getInstance(Locale)
* getInstance(Locale.getDefault(Locale.Category.FORMAT))}.
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @return a <code>DecimalFormatSymbols</code> instance. * @return a <code>DecimalFormatSymbols</code> instance.
* @since 1.6 * @since 1.6
*/ */
......
...@@ -348,7 +348,8 @@ public class MessageFormat extends Format { ...@@ -348,7 +348,8 @@ public class MessageFormat extends Format {
private static final long serialVersionUID = 6479157306784022952L; private static final long serialVersionUID = 6479157306784022952L;
/** /**
* Constructs a MessageFormat for the default locale and the * Constructs a MessageFormat for the default
* {@link java.util.Locale.Category#FORMAT FORMAT} locale and the
* specified pattern. * specified pattern.
* The constructor first sets the locale, then parses the pattern and * The constructor first sets the locale, then parses the pattern and
* creates a list of subformats for the format elements contained in it. * creates a list of subformats for the format elements contained in it.
......
...@@ -389,7 +389,8 @@ public abstract class NumberFormat extends Format { ...@@ -389,7 +389,8 @@ public abstract class NumberFormat extends Format {
//============== Locale Stuff ===================== //============== Locale Stuff =====================
/** /**
* Returns a general-purpose number format for the current default locale. * Returns a general-purpose number format for the current default
* {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* This is the same as calling * This is the same as calling
* {@link #getNumberInstance() getNumberInstance()}. * {@link #getNumberInstance() getNumberInstance()}.
*/ */
...@@ -407,7 +408,13 @@ public abstract class NumberFormat extends Format { ...@@ -407,7 +408,13 @@ public abstract class NumberFormat extends Format {
} }
/** /**
* Returns a general-purpose number format for the current default locale. * Returns a general-purpose number format for the current default
* {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* <p>This is equivalent to calling
* {@link #getNumberInstance(Locale)
* getNumberInstance(Locale.getDefault(Locale.Category.FORMAT))}.
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
*/ */
public final static NumberFormat getNumberInstance() { public final static NumberFormat getNumberInstance() {
return getInstance(Locale.getDefault(Locale.Category.FORMAT), NUMBERSTYLE); return getInstance(Locale.getDefault(Locale.Category.FORMAT), NUMBERSTYLE);
...@@ -421,14 +428,20 @@ public abstract class NumberFormat extends Format { ...@@ -421,14 +428,20 @@ public abstract class NumberFormat extends Format {
} }
/** /**
* Returns an integer number format for the current default locale. The * Returns an integer number format for the current default
* {@link java.util.Locale.Category#FORMAT FORMAT} locale. The
* returned number format is configured to round floating point numbers * returned number format is configured to round floating point numbers
* to the nearest integer using half-even rounding (see {@link * to the nearest integer using half-even rounding (see {@link
* java.math.RoundingMode#HALF_EVEN RoundingMode.HALF_EVEN}) for formatting, * java.math.RoundingMode#HALF_EVEN RoundingMode.HALF_EVEN}) for formatting,
* and to parse only the integer part of an input string (see {@link * and to parse only the integer part of an input string (see {@link
* #isParseIntegerOnly isParseIntegerOnly}). * #isParseIntegerOnly isParseIntegerOnly}).
* <p>This is equivalent to calling
* {@link #getIntegerInstance(Locale)
* getIntegerInstance(Locale.getDefault(Locale.Category.FORMAT))}.
* *
* @see #getRoundingMode() * @see #getRoundingMode()
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @return a number format for integer values * @return a number format for integer values
* @since 1.4 * @since 1.4
*/ */
...@@ -453,7 +466,14 @@ public abstract class NumberFormat extends Format { ...@@ -453,7 +466,14 @@ public abstract class NumberFormat extends Format {
} }
/** /**
* Returns a currency format for the current default locale. * Returns a currency format for the current default
* {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* <p>This is equivalent to calling
* {@link #getCurrencyInstance(Locale)
* getCurrencyInstance(Locale.getDefault(Locale.Category.FORMAT))}.
*
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
*/ */
public final static NumberFormat getCurrencyInstance() { public final static NumberFormat getCurrencyInstance() {
return getInstance(Locale.getDefault(Locale.Category.FORMAT), CURRENCYSTYLE); return getInstance(Locale.getDefault(Locale.Category.FORMAT), CURRENCYSTYLE);
...@@ -467,7 +487,14 @@ public abstract class NumberFormat extends Format { ...@@ -467,7 +487,14 @@ public abstract class NumberFormat extends Format {
} }
/** /**
* Returns a percentage format for the current default locale. * Returns a percentage format for the current default
* {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* <p>This is equivalent to calling
* {@link #getPercentInstance(Locale)
* getPercentInstance(Locale.getDefault(Locale.Category.FORMAT))}.
*
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
*/ */
public final static NumberFormat getPercentInstance() { public final static NumberFormat getPercentInstance() {
return getInstance(Locale.getDefault(Locale.Category.FORMAT), PERCENTSTYLE); return getInstance(Locale.getDefault(Locale.Category.FORMAT), PERCENTSTYLE);
......
...@@ -547,7 +547,8 @@ public class SimpleDateFormat extends DateFormat { ...@@ -547,7 +547,8 @@ public class SimpleDateFormat extends DateFormat {
/** /**
* Constructs a <code>SimpleDateFormat</code> using the default pattern and * Constructs a <code>SimpleDateFormat</code> using the default pattern and
* date format symbols for the default locale. * date format symbols for the default
* {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* <b>Note:</b> This constructor may not support all locales. * <b>Note:</b> This constructor may not support all locales.
* For full coverage, use the factory methods in the {@link DateFormat} * For full coverage, use the factory methods in the {@link DateFormat}
* class. * class.
...@@ -560,11 +561,17 @@ public class SimpleDateFormat extends DateFormat { ...@@ -560,11 +561,17 @@ public class SimpleDateFormat extends DateFormat {
/** /**
* Constructs a <code>SimpleDateFormat</code> using the given pattern and * Constructs a <code>SimpleDateFormat</code> using the given pattern and
* the default date format symbols for the default locale. * the default date format symbols for the default
* {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* <b>Note:</b> This constructor may not support all locales. * <b>Note:</b> This constructor may not support all locales.
* For full coverage, use the factory methods in the {@link DateFormat} * For full coverage, use the factory methods in the {@link DateFormat}
* class. * class.
* <p>This is equivalent to calling
* {@link #SimpleDateFormat(String, Locale)
* SimpleDateFormat(pattern, Locale.getDefault(Locale.Category.FORMAT))}.
* *
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @param pattern the pattern describing the date and time format * @param pattern the pattern describing the date and time format
* @exception NullPointerException if the given pattern is null * @exception NullPointerException if the given pattern is null
* @exception IllegalArgumentException if the given pattern is invalid * @exception IllegalArgumentException if the given pattern is invalid
......
...@@ -121,10 +121,16 @@ public final class DateTimeFormatSymbols { ...@@ -121,10 +121,16 @@ public final class DateTimeFormatSymbols {
} }
/** /**
* Obtains symbols for the default locale. * Obtains symbols for the default
* {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* <p> * <p>
* This method provides access to locale sensitive symbols. * This method provides access to locale sensitive symbols.
* <p>
* This is equivalent to calling
* {@link #of(Locale)
* of(Locale.getDefault(Locale.Category.FORMAT))}.
* *
* @see java.util.Locale.Category#FORMAT
* @return the info, not null * @return the info, not null
*/ */
public static DateTimeFormatSymbols ofDefaultLocale() { public static DateTimeFormatSymbols ofDefaultLocale() {
......
...@@ -1572,7 +1572,8 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca ...@@ -1572,7 +1572,8 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
/** /**
* Constructs a Calendar with the default time zone * Constructs a Calendar with the default time zone
* and locale. * and the default {@link java.util.Locale.Category#FORMAT FORMAT}
* locale.
* @see TimeZone#getDefault * @see TimeZone#getDefault
*/ */
protected Calendar() protected Calendar()
...@@ -1600,7 +1601,8 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca ...@@ -1600,7 +1601,8 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
/** /**
* Gets a calendar using the default time zone and locale. The * Gets a calendar using the default time zone and locale. The
* <code>Calendar</code> returned is based on the current time * <code>Calendar</code> returned is based on the current time
* in the default time zone with the default locale. * in the default time zone with the default
* {@link Locale.Category#FORMAT FORMAT} locale.
* *
* @return a Calendar. * @return a Calendar.
*/ */
...@@ -1614,7 +1616,8 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca ...@@ -1614,7 +1616,8 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
/** /**
* Gets a calendar using the specified time zone and default locale. * Gets a calendar using the specified time zone and default locale.
* The <code>Calendar</code> returned is based on the current time * The <code>Calendar</code> returned is based on the current time
* in the given time zone with the default locale. * in the given time zone with the default
* {@link Locale.Category#FORMAT FORMAT} locale.
* *
* @param zone the time zone to use * @param zone the time zone to use
* @return a Calendar. * @return a Calendar.
......
...@@ -472,12 +472,18 @@ public final class Currency implements Serializable { ...@@ -472,12 +472,18 @@ public final class Currency implements Serializable {
} }
/** /**
* Gets the symbol of this currency for the default locale. * Gets the symbol of this currency for the default
* {@link Locale.Category#DISPLAY DISPLAY} locale.
* For example, for the US Dollar, the symbol is "$" if the default * For example, for the US Dollar, the symbol is "$" if the default
* locale is the US, while for other locales it may be "US$". If no * locale is the US, while for other locales it may be "US$". If no
* symbol can be determined, the ISO 4217 currency code is returned. * symbol can be determined, the ISO 4217 currency code is returned.
* <p>
* This is equivalent to calling
* {@link #getSymbol(Locale)
* getSymbol(Locale.getDefault(Locale.Category.DISPLAY))}.
* *
* @return the symbol of this currency for the default locale * @return the symbol of this currency for the default
* {@link Locale.Category#DISPLAY DISPLAY} locale
*/ */
public String getSymbol() { public String getSymbol() {
return getSymbol(Locale.getDefault(Locale.Category.DISPLAY)); return getSymbol(Locale.getDefault(Locale.Category.DISPLAY));
...@@ -533,10 +539,16 @@ public final class Currency implements Serializable { ...@@ -533,10 +539,16 @@ public final class Currency implements Serializable {
/** /**
* Gets the name that is suitable for displaying this currency for * Gets the name that is suitable for displaying this currency for
* the default locale. If there is no suitable display name found * the default {@link Locale.Category#DISPLAY DISPLAY} locale.
* If there is no suitable display name found
* for the default locale, the ISO 4217 currency code is returned. * for the default locale, the ISO 4217 currency code is returned.
* <p>
* This is equivalent to calling
* {@link #getDisplayName(Locale)
* getDisplayName(Locale.getDefault(Locale.Category.DISPLAY))}.
* *
* @return the display name of this currency for the default locale * @return the display name of this currency for the default
* {@link Locale.Category#DISPLAY DISPLAY} locale
* @since 1.7 * @since 1.7
*/ */
public String getDisplayName() { public String getDisplayName() {
......
...@@ -1900,7 +1900,8 @@ public final class Formatter implements Closeable, Flushable { ...@@ -1900,7 +1900,8 @@ public final class Formatter implements Closeable, Flushable {
* which may be retrieved by invoking {@link #out out()} and whose * which may be retrieved by invoking {@link #out out()} and whose
* current content may be converted into a string by invoking {@link * current content may be converted into a string by invoking {@link
* #toString toString()}. The locale used is the {@linkplain * #toString toString()}. The locale used is the {@linkplain
* Locale#getDefault() default locale} for this instance of the Java * Locale#getDefault(Locale.Category) default locale} for
* {@linkplain Locale.Category#FORMAT formatting} for this instance of the Java
* virtual machine. * virtual machine.
*/ */
public Formatter() { public Formatter() {
...@@ -1910,8 +1911,10 @@ public final class Formatter implements Closeable, Flushable { ...@@ -1910,8 +1911,10 @@ public final class Formatter implements Closeable, Flushable {
/** /**
* Constructs a new formatter with the specified destination. * Constructs a new formatter with the specified destination.
* *
* <p> The locale used is the {@linkplain Locale#getDefault() default * <p> The locale used is the {@linkplain
* locale} for this instance of the Java virtual machine. * Locale#getDefault(Locale.Category) default locale} for
* {@linkplain Locale.Category#FORMAT formatting} for this instance of the Java
* virtual machine.
* *
* @param a * @param a
* Destination for the formatted output. If {@code a} is * Destination for the formatted output. If {@code a} is
...@@ -1961,8 +1964,10 @@ public final class Formatter implements Closeable, Flushable { ...@@ -1961,8 +1964,10 @@ public final class Formatter implements Closeable, Flushable {
* java.nio.charset.Charset#defaultCharset() default charset} for this * java.nio.charset.Charset#defaultCharset() default charset} for this
* instance of the Java virtual machine. * instance of the Java virtual machine.
* *
* <p> The locale used is the {@linkplain Locale#getDefault() default * <p> The locale used is the {@linkplain
* locale} for this instance of the Java virtual machine. * Locale#getDefault(Locale.Category) default locale} for
* {@linkplain Locale.Category#FORMAT formatting} for this instance of the Java
* virtual machine.
* *
* @param fileName * @param fileName
* The name of the file to use as the destination of this * The name of the file to use as the destination of this
...@@ -1989,8 +1994,10 @@ public final class Formatter implements Closeable, Flushable { ...@@ -1989,8 +1994,10 @@ public final class Formatter implements Closeable, Flushable {
/** /**
* Constructs a new formatter with the specified file name and charset. * Constructs a new formatter with the specified file name and charset.
* *
* <p> The locale used is the {@linkplain Locale#getDefault default * <p> The locale used is the {@linkplain
* locale} for this instance of the Java virtual machine. * Locale#getDefault(Locale.Category) default locale} for
* {@linkplain Locale.Category#FORMAT formatting} for this instance of the Java
* virtual machine.
* *
* @param fileName * @param fileName
* The name of the file to use as the destination of this * The name of the file to use as the destination of this
...@@ -2068,8 +2075,10 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2068,8 +2075,10 @@ public final class Formatter implements Closeable, Flushable {
* java.nio.charset.Charset#defaultCharset() default charset} for this * java.nio.charset.Charset#defaultCharset() default charset} for this
* instance of the Java virtual machine. * instance of the Java virtual machine.
* *
* <p> The locale used is the {@linkplain Locale#getDefault() default * <p> The locale used is the {@linkplain
* locale} for this instance of the Java virtual machine. * Locale#getDefault(Locale.Category) default locale} for
* {@linkplain Locale.Category#FORMAT formatting} for this instance of the Java
* virtual machine.
* *
* @param file * @param file
* The file to use as the destination of this formatter. If the * The file to use as the destination of this formatter. If the
...@@ -2096,8 +2105,10 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2096,8 +2105,10 @@ public final class Formatter implements Closeable, Flushable {
/** /**
* Constructs a new formatter with the specified file and charset. * Constructs a new formatter with the specified file and charset.
* *
* <p> The locale used is the {@linkplain Locale#getDefault default * <p> The locale used is the {@linkplain
* locale} for this instance of the Java virtual machine. * Locale#getDefault(Locale.Category) default locale} for
* {@linkplain Locale.Category#FORMAT formatting} for this instance of the Java
* virtual machine.
* *
* @param file * @param file
* The file to use as the destination of this formatter. If the * The file to use as the destination of this formatter. If the
...@@ -2171,8 +2182,10 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2171,8 +2182,10 @@ public final class Formatter implements Closeable, Flushable {
/** /**
* Constructs a new formatter with the specified print stream. * Constructs a new formatter with the specified print stream.
* *
* <p> The locale used is the {@linkplain Locale#getDefault() default * <p> The locale used is the {@linkplain
* locale} for this instance of the Java virtual machine. * Locale#getDefault(Locale.Category) default locale} for
* {@linkplain Locale.Category#FORMAT formatting} for this instance of the Java
* virtual machine.
* *
* <p> Characters are written to the given {@link java.io.PrintStream * <p> Characters are written to the given {@link java.io.PrintStream
* PrintStream} object and are therefore encoded using that object's * PrintStream} object and are therefore encoded using that object's
...@@ -2193,8 +2206,10 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2193,8 +2206,10 @@ public final class Formatter implements Closeable, Flushable {
* java.nio.charset.Charset#defaultCharset() default charset} for this * java.nio.charset.Charset#defaultCharset() default charset} for this
* instance of the Java virtual machine. * instance of the Java virtual machine.
* *
* <p> The locale used is the {@linkplain Locale#getDefault() default * <p> The locale used is the {@linkplain
* locale} for this instance of the Java virtual machine. * Locale#getDefault(Locale.Category) default locale} for
* {@linkplain Locale.Category#FORMAT formatting} for this instance of the Java
* virtual machine.
* *
* @param os * @param os
* The output stream to use as the destination of this formatter. * The output stream to use as the destination of this formatter.
...@@ -2209,8 +2224,10 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2209,8 +2224,10 @@ public final class Formatter implements Closeable, Flushable {
* Constructs a new formatter with the specified output stream and * Constructs a new formatter with the specified output stream and
* charset. * charset.
* *
* <p> The locale used is the {@linkplain Locale#getDefault default * <p> The locale used is the {@linkplain
* locale} for this instance of the Java virtual machine. * Locale#getDefault(Locale.Category) default locale} for
* {@linkplain Locale.Category#FORMAT formatting} for this instance of the Java
* virtual machine.
* *
* @param os * @param os
* The output stream to use as the destination of this formatter. * The output stream to use as the destination of this formatter.
......
...@@ -587,7 +587,8 @@ public class GregorianCalendar extends Calendar { ...@@ -587,7 +587,8 @@ public class GregorianCalendar extends Calendar {
/** /**
* Constructs a default <code>GregorianCalendar</code> using the current time * Constructs a default <code>GregorianCalendar</code> using the current time
* in the default time zone with the default locale. * in the default time zone with the default
* {@link Locale.Category#FORMAT FORMAT} locale.
*/ */
public GregorianCalendar() { public GregorianCalendar() {
this(TimeZone.getDefaultRef(), Locale.getDefault(Locale.Category.FORMAT)); this(TimeZone.getDefaultRef(), Locale.getDefault(Locale.Category.FORMAT));
...@@ -596,7 +597,8 @@ public class GregorianCalendar extends Calendar { ...@@ -596,7 +597,8 @@ public class GregorianCalendar extends Calendar {
/** /**
* Constructs a <code>GregorianCalendar</code> based on the current time * Constructs a <code>GregorianCalendar</code> based on the current time
* in the given time zone with the default locale. * in the given time zone with the default
* {@link Locale.Category#FORMAT FORMAT} locale.
* *
* @param zone the given time zone. * @param zone the given time zone.
*/ */
......
...@@ -351,7 +351,8 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; ...@@ -351,7 +351,8 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
* you can use <code>getDisplayLanguage</code> to get the name of * you can use <code>getDisplayLanguage</code> to get the name of
* the language suitable for displaying to the user. Interestingly, * the language suitable for displaying to the user. Interestingly,
* the <code>getDisplayXXX</code> methods are themselves locale-sensitive * the <code>getDisplayXXX</code> methods are themselves locale-sensitive
* and have two versions: one that uses the default locale and one * and have two versions: one that uses the default
* {@link Locale.Category#DISPLAY DISPLAY} locale and one
* that uses the locale specified as an argument. * that uses the locale specified as an argument.
* *
* <p>The Java Platform provides a number of classes that perform locale-sensitive * <p>The Java Platform provides a number of classes that perform locale-sensitive
...@@ -369,7 +370,8 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; ...@@ -369,7 +370,8 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
* </pre> * </pre>
* </blockquote> * </blockquote>
* Each of these methods has two variants; one with an explicit locale * Each of these methods has two variants; one with an explicit locale
* and one without; the latter uses the default locale: * and one without; the latter uses the default
* {@link Locale.Category#FORMAT FORMAT} locale:
* <blockquote> * <blockquote>
* <pre> * <pre>
* NumberFormat.getInstance(myLocale) * NumberFormat.getInstance(myLocale)
...@@ -1645,11 +1647,15 @@ public final class Locale implements Cloneable, Serializable { ...@@ -1645,11 +1647,15 @@ public final class Locale implements Cloneable, Serializable {
/** /**
* Returns a name for the locale's language that is appropriate for display to the * Returns a name for the locale's language that is appropriate for display to the
* user. * user.
* If possible, the name returned will be localized for the default locale. * If possible, the name returned will be localized for the default
* For example, if the locale is fr_FR and the default locale * {@link Locale.Category#DISPLAY DISPLAY} locale.
* For example, if the locale is fr_FR and the default
* {@link Locale.Category#DISPLAY DISPLAY} locale
* is en_US, getDisplayLanguage() will return "French"; if the locale is en_US and * is en_US, getDisplayLanguage() will return "French"; if the locale is en_US and
* the default locale is fr_FR, getDisplayLanguage() will return "anglais". * the default {@link Locale.Category#DISPLAY DISPLAY} locale is fr_FR,
* If the name returned cannot be localized for the default locale, * getDisplayLanguage() will return "anglais".
* If the name returned cannot be localized for the default
* {@link Locale.Category#DISPLAY DISPLAY} locale,
* (say, we don't have a Japanese name for Croatian), * (say, we don't have a Japanese name for Croatian),
* this function falls back on the English name, and uses the ISO code as a last-resort * this function falls back on the English name, and uses the ISO code as a last-resort
* value. If the locale doesn't specify a language, this function returns the empty string. * value. If the locale doesn't specify a language, this function returns the empty string.
...@@ -1679,10 +1685,12 @@ public final class Locale implements Cloneable, Serializable { ...@@ -1679,10 +1685,12 @@ public final class Locale implements Cloneable, Serializable {
/** /**
* Returns a name for the the locale's script that is appropriate for display to * Returns a name for the the locale's script that is appropriate for display to
* the user. If possible, the name will be localized for the default locale. Returns * the user. If possible, the name will be localized for the default
* {@link Locale.Category#DISPLAY DISPLAY} locale. Returns
* the empty string if this locale doesn't specify a script code. * the empty string if this locale doesn't specify a script code.
* *
* @return the display name of the script code for the current default locale * @return the display name of the script code for the current default
* {@link Locale.Category#DISPLAY DISPLAY} locale
* @since 1.7 * @since 1.7
*/ */
public String getDisplayScript() { public String getDisplayScript() {
...@@ -1695,7 +1703,8 @@ public final class Locale implements Cloneable, Serializable { ...@@ -1695,7 +1703,8 @@ public final class Locale implements Cloneable, Serializable {
* localized for the given locale. Returns the empty string if * localized for the given locale. Returns the empty string if
* this locale doesn't specify a script code. * this locale doesn't specify a script code.
* *
* @return the display name of the script code for the current default locale * @return the display name of the script code for the current default
* {@link Locale.Category#DISPLAY DISPLAY} locale
* @throws NullPointerException if <code>inLocale</code> is <code>null</code> * @throws NullPointerException if <code>inLocale</code> is <code>null</code>
* @since 1.7 * @since 1.7
*/ */
...@@ -1706,11 +1715,15 @@ public final class Locale implements Cloneable, Serializable { ...@@ -1706,11 +1715,15 @@ public final class Locale implements Cloneable, Serializable {
/** /**
* Returns a name for the locale's country that is appropriate for display to the * Returns a name for the locale's country that is appropriate for display to the
* user. * user.
* If possible, the name returned will be localized for the default locale. * If possible, the name returned will be localized for the default
* For example, if the locale is fr_FR and the default locale * {@link Locale.Category#DISPLAY DISPLAY} locale.
* For example, if the locale is fr_FR and the default
* {@link Locale.Category#DISPLAY DISPLAY} locale
* is en_US, getDisplayCountry() will return "France"; if the locale is en_US and * is en_US, getDisplayCountry() will return "France"; if the locale is en_US and
* the default locale is fr_FR, getDisplayCountry() will return "Etats-Unis". * the default {@link Locale.Category#DISPLAY DISPLAY} locale is fr_FR,
* If the name returned cannot be localized for the default locale, * getDisplayCountry() will return "Etats-Unis".
* If the name returned cannot be localized for the default
* {@link Locale.Category#DISPLAY DISPLAY} locale,
* (say, we don't have a Japanese name for Croatia), * (say, we don't have a Japanese name for Croatia),
* this function falls back on the English name, and uses the ISO code as a last-resort * this function falls back on the English name, and uses the ISO code as a last-resort
* value. If the locale doesn't specify a country, this function returns the empty string. * value. If the locale doesn't specify a country, this function returns the empty string.
...@@ -1762,7 +1775,8 @@ public final class Locale implements Cloneable, Serializable { ...@@ -1762,7 +1775,8 @@ public final class Locale implements Cloneable, Serializable {
/** /**
* Returns a name for the locale's variant code that is appropriate for display to the * Returns a name for the locale's variant code that is appropriate for display to the
* user. If possible, the name will be localized for the default locale. If the locale * user. If possible, the name will be localized for the default
* {@link Locale.Category#DISPLAY DISPLAY} locale. If the locale
* doesn't specify a variant code, this function returns the empty string. * doesn't specify a variant code, this function returns the empty string.
*/ */
public final String getDisplayVariant() { public final String getDisplayVariant() {
......
...@@ -151,7 +151,8 @@ import sun.misc.LRUCache; ...@@ -151,7 +151,8 @@ import sun.misc.LRUCache;
* <p> An instance of this class is capable of scanning numbers in the standard * <p> An instance of this class is capable of scanning numbers in the standard
* formats as well as in the formats of the scanner's locale. A scanner's * formats as well as in the formats of the scanner's locale. A scanner's
* <a name="initial-locale">initial locale </a>is the value returned by the {@link * <a name="initial-locale">initial locale </a>is the value returned by the {@link
* java.util.Locale#getDefault} method; it may be changed via the {@link * java.util.Locale#getDefault(Locale.Category)
* Locale.getDefault(Locale.Category.FORMAT)} method; it may be changed via the {@link
* #useLocale} method. The {@link #reset} method will reset the value of the * #useLocale} method. The {@link #reset} method will reset the value of the
* scanner's locale to the initial locale regardless of whether it was * scanner's locale to the initial locale regardless of whether it was
* previously changed. * previously changed.
...@@ -2641,7 +2642,7 @@ public final class Scanner implements Iterator<String>, Closeable { ...@@ -2641,7 +2642,7 @@ public final class Scanner implements Iterator<String>, Closeable {
* *
* <blockquote><pre> * <blockquote><pre>
* scanner.useDelimiter("\\p{javaWhitespace}+") * scanner.useDelimiter("\\p{javaWhitespace}+")
* .useLocale(Locale.getDefault()) * .useLocale(Locale.getDefault(Locale.Category.FORMAT))
* .useRadix(10); * .useRadix(10);
* </pre></blockquote> * </pre></blockquote>
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册