Annotation Interface Format
@Documented
@Retention(RUNTIME)
@Target({TYPE_USE,TYPE_PARAMETER})
@SubtypeOf(UnknownFormat.class)
public @interface Format
This annotation, attached to a String type, indicates that the String may be passed to
Formatter.format
and similar methods.
The annotation's value represents the valid arguments that may be passed to the format method. For example:
The annotation indicates that the format string requires any Object as the first parameter (@Format({GENERAL, INT}) String f = "String '%s' has length %d"; String.format(f, "Example", 7);
ConversionCategory.GENERAL
) and an integer as the second parameter (ConversionCategory.INT
). The format string accepts any values as additional parameters (because
it ignores them).- See Also:
- See the Checker Framework Manual:
- Format String Checker
-
Required Element Summary
Modifier and TypeRequired ElementDescriptionAn array ofConversionCategory
, indicating the types of legal remaining arguments when a value of the annotated type is used as the first argument toFormatter.format
and similar methods.
-
Element Details
-
value
ConversionCategory[] valueAn array ofConversionCategory
, indicating the types of legal remaining arguments when a value of the annotated type is used as the first argument toFormatter.format
and similar methods.- Returns:
- types that can be used as values when a value of this type is the format string
-