8019857: Fix doclint errors in java.util.Format*
Fix doclint errors in java.util.Format*. Reviewed-by: darcy
This commit is contained in:
parent
93a8ac2246
commit
c70d472774
jdk/src/share/classes/java/util
@ -36,7 +36,7 @@ import java.io.IOException;
|
||||
* For example, the following class prints out different representations of a
|
||||
* stock's name depending on the flags and length constraints:
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* {@code
|
||||
* import java.nio.CharBuffer;
|
||||
* import java.util.Formatter;
|
||||
* import java.util.Formattable;
|
||||
@ -89,12 +89,12 @@ import java.io.IOException;
|
||||
* return String.format("%s - %s", symbol, companyName);
|
||||
* }
|
||||
* }
|
||||
* </pre></blockquote>
|
||||
* }
|
||||
*
|
||||
* <p> When used in conjunction with the {@link java.util.Formatter}, the above
|
||||
* class produces the following output for various format strings.
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* {@code
|
||||
* Formatter fmt = new Formatter();
|
||||
* StockName sn = new StockName("HUGE", "Huge Fruit, Inc.",
|
||||
* "Fruit Titanesque, Inc.");
|
||||
@ -104,7 +104,7 @@ import java.io.IOException;
|
||||
* fmt.format("%-10.8s", sn); // -> "HUGE "
|
||||
* fmt.format("%.12s", sn); // -> "Huge Fruit,*"
|
||||
* fmt.format(Locale.FRANCE, "%25s", sn); // -> " Fruit Titanesque, Inc."
|
||||
* </pre></blockquote>
|
||||
* }
|
||||
*
|
||||
* <p> Formattables are not necessarily safe for multithreaded access. Thread
|
||||
* safety is optional and may be enforced by classes that extend and implement
|
||||
|
@ -841,7 +841,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
*
|
||||
* <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
|
||||
* exponent (as appropriate for the data type), the following transformation
|
||||
@ -860,7 +860,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* substituted.
|
||||
*
|
||||
* <li> If the {@code ','} (<tt>'\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
|
||||
* inserted by scanning the integer part of the string from least significant
|
||||
* to most significant digits and inserting a separator at intervals defined by
|
||||
@ -902,7 +902,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <tr><td valign="top"> {@code 'd'}
|
||||
* <td valign="top"> <tt>'\u0054'</tt>
|
||||
* <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
|
||||
* the zero padding will occur after the sign.
|
||||
@ -1011,7 +1011,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <td valign="top"> <tt>'\u002c'</tt>
|
||||
* <td> Requires the output to include the locale-specific {@linkplain
|
||||
* 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.
|
||||
*
|
||||
* <tr><td valign="top"> {@code '('}
|
||||
@ -1060,7 +1060,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <tr><td valign="top"> {@code 'd'}
|
||||
* <td valign="top"> <tt>'\u0054'</tt>
|
||||
* <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
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
@ -1155,7 +1155,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <td valign="top"> <tt>'\u0065'</tt>
|
||||
* <td> Requires the output to be formatted using <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.
|
||||
*
|
||||
@ -1168,7 +1168,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
*
|
||||
* <p> Otherwise, the result is a string that represents the sign and
|
||||
* 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
|
||||
* value.
|
||||
*
|
||||
@ -1207,7 +1207,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <tr><td valign="top"> {@code 'g'}
|
||||
* <td valign="top"> <tt>'\u0067'</tt>
|
||||
* <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.
|
||||
*
|
||||
* <p> After rounding for the precision, the formatting of the resulting
|
||||
@ -1236,12 +1236,12 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <tr><td valign="top"> {@code 'f'}
|
||||
* <td valign="top"> <tt>'\u0066'</tt>
|
||||
* <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.
|
||||
*
|
||||
* <p> The result is a string that represents the sign and magnitude
|
||||
* (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
|
||||
* value.
|
||||
*
|
||||
@ -1382,7 +1382,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <td valign="top"> <tt>'\u0065'</tt>
|
||||
* <td> Requires the output to be formatted using <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.
|
||||
*
|
||||
@ -1391,7 +1391,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
*
|
||||
* <p> Otherwise, the result is a string that represents the sign and
|
||||
* 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
|
||||
* value.
|
||||
*
|
||||
@ -1428,7 +1428,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <tr><td valign="top"> {@code 'g'}
|
||||
* <td valign="top"> <tt>'\u0067'</tt>
|
||||
* <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.
|
||||
*
|
||||
* <p> After rounding for the precision, the formatting of the resulting
|
||||
@ -1457,12 +1457,12 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <tr><td valign="top"> {@code 'f'}
|
||||
* <td valign="top"> <tt>'\u0066'</tt>
|
||||
* <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.
|
||||
*
|
||||
* <p> The result is a string that represents the sign and magnitude
|
||||
* (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
|
||||
* value.
|
||||
*
|
||||
@ -1721,7 +1721,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* conversions</a> applies. If the {@code '#'} flag is given, then a {@link
|
||||
* 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
|
||||
* the {@code width} then the output will be padded by spaces
|
||||
* (<tt>'\u0020'</tt>) until the total number of characters equals width.
|
||||
@ -1741,7 +1741,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <tr><td valign="top">{@code '%'}
|
||||
* <td> The result is a literal {@code '%'} (<tt>'\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
|
||||
* converted value is less than the {@code width} then the output will be
|
||||
* padded by spaces (<tt>'\u0020'</tt>) until the total number of
|
||||
@ -2590,7 +2590,20 @@ public final class Formatter implements Closeable, Flushable {
|
||||
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 int index = -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user