test/java/util/Formattable/StockName.java

Print this page




   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @bug 4965770 4992540 5030716
  27  * @compile -source 1.5 StockName.java
  28  * @run main StockName
  29  */
  30 
  31 import java.nio.CharBuffer;
  32 import java.util.Formatter;
  33 import java.util.Formattable;
  34 import java.util.Locale;
  35 import static java.util.FormattableFlags.*;
  36 
  37 public class StockName implements Formattable {
  38     private String symbol, companyName, frenchCompanyName;
  39 
  40     public StockName(String symbol, String companyName,
  41                      String frenchCompanyName)
  42     {
  43         this.symbol = symbol;
  44         this.companyName = companyName;
  45         this.frenchCompanyName = frenchCompanyName;
  46     }
  47 
  48     public void formatTo(Formatter fmt, int f, int width, int precision) {




   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4965770 4992540 5030716


  27  */
  28 
  29 import java.nio.CharBuffer;
  30 import java.util.Formatter;
  31 import java.util.Formattable;
  32 import java.util.Locale;
  33 import static java.util.FormattableFlags.*;
  34 
  35 public class StockName implements Formattable {
  36     private String symbol, companyName, frenchCompanyName;
  37 
  38     public StockName(String symbol, String companyName,
  39                      String frenchCompanyName)
  40     {
  41         this.symbol = symbol;
  42         this.companyName = companyName;
  43         this.frenchCompanyName = frenchCompanyName;
  44     }
  45 
  46     public void formatTo(Formatter fmt, int f, int width, int precision) {