Enum I18nConversionCategory

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<I18nConversionCategory>

    @AnnotatedFor("nullness")
    public enum I18nConversionCategory
    extends java.lang.Enum<I18nConversionCategory>
    Elements of this enumeration are used in a I18nFormat annotation to indicate the valid types that may be passed as a format parameter. For example:
    @I18nFormat({GENERAL, NUMBER}) String f = "{0}{1, number}";
     MessageFormat.format(f, "Example", 0) // valid
    The annotation indicates that the format string requires any object as the first parameter (GENERAL) and a number as the second parameter (NUMBER).
    • Enum Constant Detail

      • UNUSED

        public static final I18nConversionCategory UNUSED
        Use if a parameter is not used by the formatter. For example, in
         MessageFormat.format("{1}", a, b);
         
        only the second argument ("b") is used. The first argument ("a") is ignored.
      • DATE

        public static final I18nConversionCategory DATE
        Use if the parameter can be of date, time, or number types.
      • NUMBER

        public static final I18nConversionCategory NUMBER
        Use if the parameter can be of number or choice types. An example of choice:
        
         format("{0, choice, 0#zero|1#one|1<{0, number} is more than 1}", 2)
         
        This will print "2 is more than 1".
    • Field Detail

      • types

        public final java.lang.Class<?> @Nullable [] types
      • strings

        public final java.lang.String @Nullable [] strings
    • Method Detail

      • values

        public static I18nConversionCategory[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (I18nConversionCategory c : I18nConversionCategory.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static I18nConversionCategory valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • stringToI18nConversionCategory

        public static I18nConversionCategory stringToI18nConversionCategory​(java.lang.String string)
        Creates a conversion cagetogry from a string name.
         I18nConversionCategory.stringToI18nConversionCategory("number") == I18nConversionCategory.NUMBER;
         
        Returns:
        the I18nConversionCategory associated with the given string
      • isAssignableFrom

        public boolean isAssignableFrom​(java.lang.Class<?> argType)
        Returns true if argType can be an argument used by this format specifier.
        Parameters:
        argType - an argument type
        Returns:
        true if argType can be an argument used by this format specifier