Path: blob/master/src/java.base/share/classes/java/util/FormattableFlags.java
41152 views
/*1* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.util;2627/**28* FormattableFlags are passed to the {@link Formattable#formatTo29* Formattable.formatTo()} method and modify the output format for {@linkplain30* Formattable Formattables}. Implementations of {@link Formattable} are31* responsible for interpreting and validating any flags.32*33* @since 1.534*/35public class FormattableFlags {3637// Explicit instantiation of this class is prohibited.38private FormattableFlags() {}3940/**41* Left-justifies the output. Spaces (<code>'\u0020'</code>) will be added42* at the end of the converted value as required to fill the minimum width43* of the field. If this flag is not set then the output will be44* right-justified.45*46* <p> This flag corresponds to {@code '-'} (<code>'\u002d'</code>) in47* the format specifier.48*/49public static final int LEFT_JUSTIFY = 1<<0; // '-'5051/**52* Converts the output to upper case according to the rules of the53* {@linkplain java.util.Locale locale} given during creation of the54* {@code formatter} argument of the {@link Formattable#formatTo55* formatTo()} method. The output should be equivalent the following56* invocation of {@link String#toUpperCase(java.util.Locale)}57*58* <pre>59* out.toUpperCase() </pre>60*61* <p> This flag corresponds to {@code 'S'} (<code>'\u0053'</code>) in62* the format specifier.63*/64public static final int UPPERCASE = 1<<1; // 'S'6566/**67* Requires the output to use an alternate form. The definition of the68* form is specified by the {@code Formattable}.69*70* <p> This flag corresponds to {@code '#'} (<code>'\u0023'</code>) in71* the format specifier.72*/73public static final int ALTERNATE = 1<<2; // '#'74}757677