KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > util > FormattableFlags


1 /*
2  * @(#)FormattableFlags.java 1.1 04/04/21
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.util;
9
10 /**
11  * FomattableFlags are passed to the {@link Formattable#formatTo
12  * Formattable.formatTo()} method and modify the output format for {@linkplain
13  * Formattable Formattables}. Implementations of {@link Formattable} are
14  * responsible for interpreting and validating any flags.
15  *
16  * @version 1.1, 04/21/04
17  * @since 1.5
18  */

19 public class FormattableFlags {
20
21     // Explicit instantiation of this class is prohibited.
22
private FormattableFlags() {}
23
24     /**
25      * Left-justifies the output. Spaces (<tt>'&#92;u0020'</tt>) will be added
26      * at the end of the converted value as required to fill the minimum width
27      * of the field. If this flag is not set then the output will be
28      * right-justified.
29      *
30      * <p> This flag corresponds to <tt>'-'</tt> (<tt>'&#92;u002d'</tt>) in
31      * the format specifier.
32      */

33     public static final int LEFT_JUSTIFY = 1<<0; // '-'
34

35     /**
36      * Converts the output to upper case according to the rules of the
37      * {@linkplain java.util.Locale locale} given during creation of the
38      * <tt>formatter</tt> argument of the {@link Formattable#formatTo
39      * formatTo()} method. The output should be equivalent the following
40      * invocation of {@link String#toUpperCase(java.util.Locale)}
41      *
42      * <pre>
43      * out.toUpperCase() </pre>
44      *
45      * <p> This flag corresponds to <tt>'^'</tt> (<tt>'&#92;u005e'</tt>) in
46      * the format specifier.
47      */

48     public static final int UPPERCASE = 1<<1; // '^'
49

50     /**
51      * Requires the output to use an alternate form. The definition of the
52      * form is specified by the <tt>Formattable</tt>.
53      *
54      * <p> This flag corresponds to <tt>'#'</tt> (<tt>'&#92;u0023'</tt>) in
55      * the format specifier.
56      */

57     public static final int ALTERNATE = 1<<2; // '#'
58
}
59
Popular Tags