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. package java.util;
  8. /**
  9. * FomattableFlags are passed to the {@link Formattable#formatTo
  10. * Formattable.formatTo()} method and modify the output format for {@linkplain
  11. * Formattable Formattables}. Implementations of {@link Formattable} are
  12. * responsible for interpreting and validating any flags.
  13. *
  14. * @version 1.1, 04/21/04
  15. * @since 1.5
  16. */
  17. public class FormattableFlags {
  18. // Explicit instantiation of this class is prohibited.
  19. private FormattableFlags() {}
  20. /**
  21. * Left-justifies the output. Spaces (<tt>'\u0020'</tt>) will be added
  22. * at the end of the converted value as required to fill the minimum width
  23. * of the field. If this flag is not set then the output will be
  24. * right-justified.
  25. *
  26. * <p> This flag corresponds to <tt>'-'</tt> (<tt>'\u002d'</tt>) in
  27. * the format specifier.
  28. */
  29. public static final int LEFT_JUSTIFY = 1<<0; // '-'
  30. /**
  31. * Converts the output to upper case according to the rules of the
  32. * {@linkplain java.util.Locale locale} given during creation of the
  33. * <tt>formatter</tt> argument of the {@link Formattable#formatTo
  34. * formatTo()} method. The output should be equivalent the following
  35. * invocation of {@link String#toUpperCase(java.util.Locale)}
  36. *
  37. * <pre>
  38. * out.toUpperCase() </pre>
  39. *
  40. * <p> This flag corresponds to <tt>'^'</tt> (<tt>'\u005e'</tt>) in
  41. * the format specifier.
  42. */
  43. public static final int UPPERCASE = 1<<1; // '^'
  44. /**
  45. * Requires the output to use an alternate form. The definition of the
  46. * form is specified by the <tt>Formattable</tt>.
  47. *
  48. * <p> This flag corresponds to <tt>'#'</tt> (<tt>'\u0023'</tt>) in
  49. * the format specifier.
  50. */
  51. public static final int ALTERNATE = 1<<2; // '#'
  52. }