Source for java.util.FormattableFlags

   1: /* FormattableFlags.java --
   2:    Copyright (C) 2005  Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: 
  39: package java.util;
  40: 
  41: /** 
  42:  * This class contains a set of flags used
  43:  * by the {@link Formattable#formatTo()} method.
  44:  * They are used to modify the output of the
  45:  * {@link Formattable}.  The interpretation and
  46:  * validation of the flags is left to the
  47:  * particular {@link Formattable}.
  48:  *
  49:  * @author Tom Tromey (tromey@redhat.com)
  50:  * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
  51:  * @since 1.5 
  52:  */
  53: public class FormattableFlags
  54: {
  55: 
  56:   /**
  57:    * Requires the output to be left-justified.  Any spaces
  58:    * required to meet the specified width will be added to
  59:    * the right of the output.  The default output is
  60:    * right-justified, where spaces are added to the left.
  61:    * The output is as for the format specifier
  62:    * '-' ('\u002d').
  63:    */
  64:   public static final int LEFT_JUSTIFY = 1;
  65: 
  66:   /**
  67:    * Requires the output to be in uppercase.  The output
  68:    * should be the same as the result from calling
  69:    * {@link String#toUpperCase(java.util.Locale)} with
  70:    * the formatting locale. The output is as for the
  71:    * format specifier '^' ('\u005e').
  72:    */
  73:   public static final int UPPERCASE = 2;
  74: 
  75:   /**
  76:    * Requires the use of an alternate form, as specified
  77:    * in the documentation of {@link Formattable}.
  78:    * The output is as for the format specifier
  79:    * '#' ('\u0023').
  80:    */
  81:   public static final int ALTERNATE = 4;
  82: 
  83:   // Used internally by Formatter.
  84:   // Changes here must be reflected in the FLAGS string there.
  85: 
  86:   /**
  87:    * Requires the output to always include a '+' sign.
  88:    * The output is as for the format specifier '+'.
  89:    */
  90:   static final int PLUS = 8;
  91: 
  92:   /**
  93:    * Requires the output to include a leading space on
  94:    * positive value.  The output is as for the format
  95:    * specifier ' '.
  96:    */
  97:   static final int SPACE = 16;
  98: 
  99:   /**
 100:    * Requires the output to be zero-padded.  The output
 101:    * is as for the format specifier '0'.
 102:    */
 103:   static final int ZERO = 32;
 104: 
 105:   /**
 106:    * Requires the output to include locale-specific
 107:    * grouping operators.  The output is as for the
 108:    * format specifier ','.
 109:    */
 110:   static final int COMMA = 64;
 111: 
 112:   /**
 113:    * Requires the output to include negative numbers
 114:    * enclosed in parentheses.  The output is as for
 115:    * the format specifier '('.
 116:    */
 117:   static final int PAREN = 128;
 118: 
 119:   // Not instantiable.
 120:   private FormattableFlags()
 121:   {
 122:   }
 123: }