提交 7098705f 编写于 作者: B bpb

8019857: Fix doclint errors in java.util.Format*

Summary: Fix doclint errors in java.util.Format*.
Reviewed-by: darcy
Contributed-by: NBrian Burkhalter <brian.burkhalter@oracle.com>
上级 fc9949fb
...@@ -36,7 +36,7 @@ import java.io.IOException; ...@@ -36,7 +36,7 @@ import java.io.IOException;
* For example, the following class prints out different representations of a * For example, the following class prints out different representations of a
* stock's name depending on the flags and length constraints: * stock's name depending on the flags and length constraints:
* *
* <blockquote><pre> * {@code
* import java.nio.CharBuffer; * import java.nio.CharBuffer;
* import java.util.Formatter; * import java.util.Formatter;
* import java.util.Formattable; * import java.util.Formattable;
...@@ -89,12 +89,12 @@ import java.io.IOException; ...@@ -89,12 +89,12 @@ import java.io.IOException;
* return String.format("%s - %s", symbol, companyName); * return String.format("%s - %s", symbol, companyName);
* } * }
* } * }
* </pre></blockquote> * }
* *
* <p> When used in conjunction with the {@link java.util.Formatter}, the above * <p> When used in conjunction with the {@link java.util.Formatter}, the above
* class produces the following output for various format strings. * class produces the following output for various format strings.
* *
* <blockquote><pre> * {@code
* Formatter fmt = new Formatter(); * Formatter fmt = new Formatter();
* StockName sn = new StockName("HUGE", "Huge Fruit, Inc.", * StockName sn = new StockName("HUGE", "Huge Fruit, Inc.",
* "Fruit Titanesque, Inc."); * "Fruit Titanesque, Inc.");
...@@ -104,7 +104,7 @@ import java.io.IOException; ...@@ -104,7 +104,7 @@ import java.io.IOException;
* fmt.format("%-10.8s", sn); // -> "HUGE " * fmt.format("%-10.8s", sn); // -> "HUGE "
* fmt.format("%.12s", sn); // -> "Huge Fruit,*" * fmt.format("%.12s", sn); // -> "Huge Fruit,*"
* fmt.format(Locale.FRANCE, "%25s", sn); // -> " Fruit Titanesque, Inc." * fmt.format(Locale.FRANCE, "%25s", sn); // -> " Fruit Titanesque, Inc."
* </pre></blockquote> * }
* *
* <p> Formattables are not necessarily safe for multithreaded access. Thread * <p> Formattables are not necessarily safe for multithreaded access. Thread
* safety is optional and may be enforced by classes that extend and implement * safety is optional and may be enforced by classes that extend and implement
......
...@@ -841,7 +841,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -841,7 +841,7 @@ import sun.misc.FormattedFloatingDecimal;
* *
* <p> Numeric types will be formatted according to the following algorithm: * <p> Numeric types will be formatted according to the following algorithm:
* *
* <p><b><a name="l10n algorithm"> Number Localization Algorithm</a></b> * <p><b><a name="L10nAlgorithm"> Number Localization Algorithm</a></b>
* *
* <p> After digits are obtained for the integer part, fractional part, and * <p> After digits are obtained for the integer part, fractional part, and
* exponent (as appropriate for the data type), the following transformation * exponent (as appropriate for the data type), the following transformation
...@@ -860,7 +860,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -860,7 +860,7 @@ import sun.misc.FormattedFloatingDecimal;
* substituted. * substituted.
* *
* <li> If the {@code ','} (<tt>'&#92;u002c'</tt>) * <li> If the {@code ','} (<tt>'&#92;u002c'</tt>)
* <a name="l10n group">flag</a> is given, then the locale-specific {@linkplain * <a name="L10nGroup">flag</a> is given, then the locale-specific {@linkplain
* java.text.DecimalFormatSymbols#getGroupingSeparator grouping separator} is * java.text.DecimalFormatSymbols#getGroupingSeparator grouping separator} is
* inserted by scanning the integer part of the string from least significant * inserted by scanning the integer part of the string from least significant
* to most significant digits and inserting a separator at intervals defined by * to most significant digits and inserting a separator at intervals defined by
...@@ -902,7 +902,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -902,7 +902,7 @@ import sun.misc.FormattedFloatingDecimal;
* <tr><td valign="top"> {@code 'd'} * <tr><td valign="top"> {@code 'd'}
* <td valign="top"> <tt>'&#92;u0054'</tt> * <td valign="top"> <tt>'&#92;u0054'</tt>
* <td> Formats the argument as a decimal integer. The <a * <td> Formats the argument as a decimal integer. The <a
* href="#l10n algorithm">localization algorithm</a> is applied. * href="#L10nAlgorithm">localization algorithm</a> is applied.
* *
* <p> If the {@code '0'} flag is given and the value is negative, then * <p> If the {@code '0'} flag is given and the value is negative, then
* the zero padding will occur after the sign. * the zero padding will occur after the sign.
...@@ -1011,7 +1011,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1011,7 +1011,7 @@ import sun.misc.FormattedFloatingDecimal;
* <td valign="top"> <tt>'&#92;u002c'</tt> * <td valign="top"> <tt>'&#92;u002c'</tt>
* <td> Requires the output to include the locale-specific {@linkplain * <td> Requires the output to include the locale-specific {@linkplain
* java.text.DecimalFormatSymbols#getGroupingSeparator group separators} as * java.text.DecimalFormatSymbols#getGroupingSeparator group separators} as
* described in the <a href="#l10n group">"group" section</a> of the * described in the <a href="#L10nGroup">"group" section</a> of the
* localization algorithm. * localization algorithm.
* *
* <tr><td valign="top"> {@code '('} * <tr><td valign="top"> {@code '('}
...@@ -1060,7 +1060,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1060,7 +1060,7 @@ import sun.misc.FormattedFloatingDecimal;
* <tr><td valign="top"> {@code 'd'} * <tr><td valign="top"> {@code 'd'}
* <td valign="top"> <tt>'&#92;u0054'</tt> * <td valign="top"> <tt>'&#92;u0054'</tt>
* <td> Requires the output to be formatted as a decimal integer. The <a * <td> Requires the output to be formatted as a decimal integer. The <a
* href="#l10n algorithm">localization algorithm</a> is applied. * href="#L10nAlgorithm">localization algorithm</a> is applied.
* *
* <p> If the {@code '#'} flag is given {@link * <p> If the {@code '#'} flag is given {@link
* FormatFlagsConversionMismatchException} will be thrown. * FormatFlagsConversionMismatchException} will be thrown.
...@@ -1155,7 +1155,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1155,7 +1155,7 @@ import sun.misc.FormattedFloatingDecimal;
* <td valign="top"> <tt>'&#92;u0065'</tt> * <td valign="top"> <tt>'&#92;u0065'</tt>
* <td> Requires the output to be formatted using <a * <td> Requires the output to be formatted using <a
* name="scientific">computerized scientific notation</a>. The <a * name="scientific">computerized scientific notation</a>. The <a
* href="#l10n algorithm">localization algorithm</a> is applied. * href="#L10nAlgorithm">localization algorithm</a> is applied.
* *
* <p> The formatting of the magnitude <i>m</i> depends upon its value. * <p> The formatting of the magnitude <i>m</i> depends upon its value.
* *
...@@ -1168,7 +1168,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1168,7 +1168,7 @@ import sun.misc.FormattedFloatingDecimal;
* *
* <p> Otherwise, the result is a string that represents the sign and * <p> Otherwise, the result is a string that represents the sign and
* magnitude (absolute value) of the argument. The formatting of the sign * magnitude (absolute value) of the argument. The formatting of the sign
* is described in the <a href="#l10n algorithm">localization * is described in the <a href="#L10nAlgorithm">localization
* algorithm</a>. The formatting of the magnitude <i>m</i> depends upon its * algorithm</a>. The formatting of the magnitude <i>m</i> depends upon its
* value. * value.
* *
...@@ -1207,7 +1207,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1207,7 +1207,7 @@ import sun.misc.FormattedFloatingDecimal;
* <tr><td valign="top"> {@code 'g'} * <tr><td valign="top"> {@code 'g'}
* <td valign="top"> <tt>'&#92;u0067'</tt> * <td valign="top"> <tt>'&#92;u0067'</tt>
* <td> Requires the output to be formatted in general scientific notation * <td> Requires the output to be formatted in general scientific notation
* as described below. The <a href="#l10n algorithm">localization * as described below. The <a href="#L10nAlgorithm">localization
* algorithm</a> is applied. * algorithm</a> is applied.
* *
* <p> After rounding for the precision, the formatting of the resulting * <p> After rounding for the precision, the formatting of the resulting
...@@ -1236,12 +1236,12 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1236,12 +1236,12 @@ import sun.misc.FormattedFloatingDecimal;
* <tr><td valign="top"> {@code 'f'} * <tr><td valign="top"> {@code 'f'}
* <td valign="top"> <tt>'&#92;u0066'</tt> * <td valign="top"> <tt>'&#92;u0066'</tt>
* <td> Requires the output to be formatted using <a name="decimal">decimal * <td> Requires the output to be formatted using <a name="decimal">decimal
* format</a>. The <a href="#l10n algorithm">localization algorithm</a> is * format</a>. The <a href="#L10nAlgorithm">localization algorithm</a> is
* applied. * applied.
* *
* <p> The result is a string that represents the sign and magnitude * <p> The result is a string that represents the sign and magnitude
* (absolute value) of the argument. The formatting of the sign is * (absolute value) of the argument. The formatting of the sign is
* described in the <a href="#l10n algorithm">localization * described in the <a href="#L10nAlgorithm">localization
* algorithm</a>. The formatting of the magnitude <i>m</i> depends upon its * algorithm</a>. The formatting of the magnitude <i>m</i> depends upon its
* value. * value.
* *
...@@ -1382,7 +1382,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1382,7 +1382,7 @@ import sun.misc.FormattedFloatingDecimal;
* <td valign="top"> <tt>'&#92;u0065'</tt> * <td valign="top"> <tt>'&#92;u0065'</tt>
* <td> Requires the output to be formatted using <a * <td> Requires the output to be formatted using <a
* name="bscientific">computerized scientific notation</a>. The <a * name="bscientific">computerized scientific notation</a>. The <a
* href="#l10n algorithm">localization algorithm</a> is applied. * href="#L10nAlgorithm">localization algorithm</a> is applied.
* *
* <p> The formatting of the magnitude <i>m</i> depends upon its value. * <p> The formatting of the magnitude <i>m</i> depends upon its value.
* *
...@@ -1391,7 +1391,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1391,7 +1391,7 @@ import sun.misc.FormattedFloatingDecimal;
* *
* <p> Otherwise, the result is a string that represents the sign and * <p> Otherwise, the result is a string that represents the sign and
* magnitude (absolute value) of the argument. The formatting of the sign * magnitude (absolute value) of the argument. The formatting of the sign
* is described in the <a href="#l10n algorithm">localization * is described in the <a href="#L10nAlgorithm">localization
* algorithm</a>. The formatting of the magnitude <i>m</i> depends upon its * algorithm</a>. The formatting of the magnitude <i>m</i> depends upon its
* value. * value.
* *
...@@ -1428,7 +1428,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1428,7 +1428,7 @@ import sun.misc.FormattedFloatingDecimal;
* <tr><td valign="top"> {@code 'g'} * <tr><td valign="top"> {@code 'g'}
* <td valign="top"> <tt>'&#92;u0067'</tt> * <td valign="top"> <tt>'&#92;u0067'</tt>
* <td> Requires the output to be formatted in general scientific notation * <td> Requires the output to be formatted in general scientific notation
* as described below. The <a href="#l10n algorithm">localization * as described below. The <a href="#L10nAlgorithm">localization
* algorithm</a> is applied. * algorithm</a> is applied.
* *
* <p> After rounding for the precision, the formatting of the resulting * <p> After rounding for the precision, the formatting of the resulting
...@@ -1457,12 +1457,12 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1457,12 +1457,12 @@ import sun.misc.FormattedFloatingDecimal;
* <tr><td valign="top"> {@code 'f'} * <tr><td valign="top"> {@code 'f'}
* <td valign="top"> <tt>'&#92;u0066'</tt> * <td valign="top"> <tt>'&#92;u0066'</tt>
* <td> Requires the output to be formatted using <a name="bdecimal">decimal * <td> Requires the output to be formatted using <a name="bdecimal">decimal
* format</a>. The <a href="#l10n algorithm">localization algorithm</a> is * format</a>. The <a href="#L10nAlgorithm">localization algorithm</a> is
* applied. * applied.
* *
* <p> The result is a string that represents the sign and magnitude * <p> The result is a string that represents the sign and magnitude
* (absolute value) of the argument. The formatting of the sign is * (absolute value) of the argument. The formatting of the sign is
* described in the <a href="#l10n algorithm">localization * described in the <a href="#L10nAlgorithm">localization
* algorithm</a>. The formatting of the magnitude <i>m</i> depends upon its * algorithm</a>. The formatting of the magnitude <i>m</i> depends upon its
* value. * value.
* *
...@@ -1721,7 +1721,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1721,7 +1721,7 @@ import sun.misc.FormattedFloatingDecimal;
* conversions</a> applies. If the {@code '#'} flag is given, then a {@link * conversions</a> applies. If the {@code '#'} flag is given, then a {@link
* FormatFlagsConversionMismatchException} will be thrown. * FormatFlagsConversionMismatchException} will be thrown.
* *
* <p> The <a name="dtWidth">width</a> is the minimum number of characters to * <p> The width is the minimum number of characters to
* be written to the output. If the length of the converted value is less than * be written to the output. If the length of the converted value is less than
* the {@code width} then the output will be padded by spaces * the {@code width} then the output will be padded by spaces
* (<tt>'&#92;u0020'</tt>) until the total number of characters equals width. * (<tt>'&#92;u0020'</tt>) until the total number of characters equals width.
...@@ -1741,7 +1741,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1741,7 +1741,7 @@ import sun.misc.FormattedFloatingDecimal;
* <tr><td valign="top">{@code '%'} * <tr><td valign="top">{@code '%'}
* <td> The result is a literal {@code '%'} (<tt>'&#92;u0025'</tt>) * <td> The result is a literal {@code '%'} (<tt>'&#92;u0025'</tt>)
* *
* <p> The <a name="dtWidth">width</a> is the minimum number of characters to * <p> The width is the minimum number of characters to
* be written to the output including the {@code '%'}. If the length of the * be written to the output including the {@code '%'}. If the length of the
* converted value is less than the {@code width} then the output will be * converted value is less than the {@code width} then the output will be
* padded by spaces (<tt>'&#92;u0020'</tt>) until the total number of * padded by spaces (<tt>'&#92;u0020'</tt>) until the total number of
...@@ -2590,7 +2590,20 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2590,7 +2590,20 @@ public final class Formatter implements Closeable, Flushable {
public String toString() { return s; } public String toString() { return s; }
} }
public enum BigDecimalLayoutForm { SCIENTIFIC, DECIMAL_FLOAT }; /**
* Enum for {@code BigDecimal} formatting.
*/
public enum BigDecimalLayoutForm {
/**
* Format the {@code BigDecimal} in computerized scientific notation.
*/
SCIENTIFIC,
/**
* Format the {@code BigDecimal} as a decimal number.
*/
DECIMAL_FLOAT
};
private class FormatSpecifier implements FormatString { private class FormatSpecifier implements FormatString {
private int index = -1; private int index = -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册