Enum Class I18nConversionCategory
java.lang.Object
java.lang.Enum<I18nConversionCategory>
org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory
- All Implemented Interfaces:
Serializable
,Comparable<I18nConversionCategory>
,Constable
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) // validThe annotation indicates that the format string requires any object as the first parameter (
GENERAL
) and a number as the second parameter (NUMBER
).- See the Checker Framework Manual:
- Internationalization Format String Checker
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic I18nConversionCategory
Returns the intersection of the two given I18nConversionCategories.boolean
isAssignableFrom
(Class<?> argType) Returns true ifargType
can be an argument used by this format specifier.static boolean
Return true if a is a subset of b.static I18nConversionCategory
stringToI18nConversionCategory
(String string) Creates a conversion cagetogry from a string name.toString()
Returns a pretty printedI18nConversionCategory
.static I18nConversionCategory
Returns the union of the two given I18nConversionCategories.static I18nConversionCategory
Returns the enum constant of this class with the specified name.static I18nConversionCategory[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UNUSED
Use if a parameter is not used by the formatter. For example, inMessageFormat.format("{1}", a, b);
only the second argument ("b") is used. The first argument ("a") is ignored. -
GENERAL
Use if the parameter can be of any type. -
DATE
Use if the parameter can be of date, time, or number types. -
NUMBER
Use if the parameter can be of number or choice types. An example of choice:
This will print "2 is more than 1".format("{0, choice, 0#zero|1#one|1<{0, number} is more than 1}", 2)
-
-
Field Details
-
types
-
strings
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
stringToI18nConversionCategory
Creates a conversion cagetogry from a string name.I18nConversionCategory.stringToI18nConversionCategory("number") == I18nConversionCategory.NUMBER;
- Returns:
- the I18nConversionCategory associated with the given string
-
isSubsetOf
Return true if a is a subset of b.- Returns:
- true if a is a subset of b
-
intersect
Returns the intersection of the two given I18nConversionCategories.I18nConversionCategory.intersect(DATE, NUMBER) == NUMBER;
-
union
Returns the union of the two given I18nConversionCategories.I18nConversionCategory.intersect(DATE, NUMBER) == DATE;
-
isAssignableFrom
Returns true ifargType
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
-
toString
Returns a pretty printedI18nConversionCategory
.- Overrides:
toString
in classEnum<I18nConversionCategory>
-