Annotation Type I18nFormat


  • @Documented
    @Retention(RUNTIME)
    @Target({TYPE_USE,TYPE_PARAMETER})
    @SubtypeOf(I18nUnknownFormat.class)
    public @interface I18nFormat
    This annotation, attached to a String type, indicates that the String may be passed to MessageFormat.format.

    The annotation's value represents the valid arguments that may be passed to the format method. For example:

    @I18nFormat({GENERAL, NUMBER}) String f;
    
     f = "{0}{1, number}"; // valid
     f = "{0} {1} {2}"; // error, the format string is stronger (more restrictive) than the specifiers.
     f = "{0, number} {1, number}"; // error, the format string is stronger (NUMBER is a subtype of GENERAL).
     
    The annotation indicates that the format string requires any object as the first parameter (I18nConversionCategory.GENERAL) and a number as the second parameter (I18nConversionCategory.NUMBER).
    See Also:
    I18nConversionCategory
    See the Checker Framework Manual:
    Internationalization Format String Checker
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      I18nConversionCategory[] value
      An array of I18nConversionCategory, indicating the types of legal remaining arguments when a value of the annotated type is used as the first argument to Message.format.