src/share/classes/java/util/Formattable.java

Print this page
rev 7582 : 8019857: Fix doclint errors in java.util.Format*
Summary: Fix doclint errors in java.util.Format*.
Reviewed-by: TBD
Contributed-by: Brian Burkhalter <brian.burkhalter@oracle.com>

*** 34,44 **** * control for formatting arbitrary objects. * * For example, the following class prints out different representations of a * stock's name depending on the flags and length constraints: * ! * <blockquote><pre> * import java.nio.CharBuffer; * import java.util.Formatter; * import java.util.Formattable; * import java.util.Locale; * import static java.util.FormattableFlags.*; --- 34,44 ---- * control for formatting arbitrary objects. * * For example, the following class prints out different representations of a * stock's name depending on the flags and length constraints: * ! * {@code * import java.nio.CharBuffer; * import java.util.Formatter; * import java.util.Formattable; * import java.util.Locale; * import static java.util.FormattableFlags.*;
*** 87,112 **** * * public String toString() { * 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> * Formatter fmt = new Formatter(); * StockName sn = new StockName("HUGE", "Huge Fruit, Inc.", * "Fruit Titanesque, Inc."); * fmt.format("%s", sn); // -> "Huge Fruit, Inc." * fmt.format("%s", sn.toString()); // -> "HUGE - Huge Fruit, Inc." * fmt.format("%#s", sn); // -> "HUGE" * 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 * this interface. * --- 87,112 ---- * * public String toString() { * return String.format("%s - %s", symbol, companyName); * } * } ! * } * * <p> When used in conjunction with the {@link java.util.Formatter}, the above * class produces the following output for various format strings. * ! * {@code * Formatter fmt = new Formatter(); * StockName sn = new StockName("HUGE", "Huge Fruit, Inc.", * "Fruit Titanesque, Inc."); * fmt.format("%s", sn); // -> "Huge Fruit, Inc." * fmt.format("%s", sn.toString()); // -> "HUGE - Huge Fruit, Inc." * fmt.format("%#s", sn); // -> "HUGE" * fmt.format("%-10.8s", sn); // -> "HUGE " * fmt.format("%.12s", sn); // -> "Huge Fruit,*" * fmt.format(Locale.FRANCE, "%25s", sn); // -> " Fruit Titanesque, Inc." ! * } * * <p> Formattables are not necessarily safe for multithreaded access. Thread * safety is optional and may be enforced by classes that extend and implement * this interface. *