001 /* FormattableFlags.java -- 002 Copyright (C) 2005 Free Software Foundation, Inc. 003 004 This file is part of GNU Classpath. 005 006 GNU Classpath is free software; you can redistribute it and/or modify 007 it under the terms of the GNU General Public License as published by 008 the Free Software Foundation; either version 2, or (at your option) 009 any later version. 010 011 GNU Classpath is distributed in the hope that it will be useful, but 012 WITHOUT ANY WARRANTY; without even the implied warranty of 013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 General Public License for more details. 015 016 You should have received a copy of the GNU General Public License 017 along with GNU Classpath; see the file COPYING. If not, write to the 018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 019 02110-1301 USA. 020 021 Linking this library statically or dynamically with other modules is 022 making a combined work based on this library. Thus, the terms and 023 conditions of the GNU General Public License cover the whole 024 combination. 025 026 As a special exception, the copyright holders of this library give you 027 permission to link this library with independent modules to produce an 028 executable, regardless of the license terms of these independent 029 modules, and to copy and distribute the resulting executable under 030 terms of your choice, provided that you also meet, for each linked 031 independent module, the terms and conditions of the license of that 032 module. An independent module is a module which is not derived from 033 or based on this library. If you modify this library, you may extend 034 this exception to your version of the library, but you are not 035 obligated to do so. If you do not wish to do so, delete this 036 exception statement from your version. */ 037 038 039 package java.util; 040 041 /** 042 * This class contains a set of flags used 043 * by the {@link Formattable#formatTo()} method. 044 * They are used to modify the output of the 045 * {@link Formattable}. The interpretation and 046 * validation of the flags is left to the 047 * particular {@link Formattable}. 048 * 049 * @author Tom Tromey (tromey@redhat.com) 050 * @author Andrew John Hughes (gnu_andrew@member.fsf.org) 051 * @since 1.5 052 */ 053 public class FormattableFlags 054 { 055 056 /** 057 * Requires the output to be left-justified. Any spaces 058 * required to meet the specified width will be added to 059 * the right of the output. The default output is 060 * right-justified, where spaces are added to the left. 061 * The output is as for the format specifier 062 * '-' ('\u002d'). 063 */ 064 public static final int LEFT_JUSTIFY = 1; 065 066 /** 067 * Requires the output to be in uppercase. The output 068 * should be the same as the result from calling 069 * {@link String#toUpperCase(java.util.Locale)} with 070 * the formatting locale. The output is as for the 071 * format specifier '^' ('\u005e'). 072 */ 073 public static final int UPPERCASE = 2; 074 075 /** 076 * Requires the use of an alternate form, as specified 077 * in the documentation of {@link Formattable}. 078 * The output is as for the format specifier 079 * '#' ('\u0023'). 080 */ 081 public static final int ALTERNATE = 4; 082 083 // Used internally by Formatter. 084 // Changes here must be reflected in the FLAGS string there. 085 086 /** 087 * Requires the output to always include a '+' sign. 088 * The output is as for the format specifier '+'. 089 */ 090 static final int PLUS = 8; 091 092 /** 093 * Requires the output to include a leading space on 094 * positive value. The output is as for the format 095 * specifier ' '. 096 */ 097 static final int SPACE = 16; 098 099 /** 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 }