@Documented @Retention(value=RUNTIME) @Target(value={TYPE_USE,TYPE_PARAMETER}) @SubtypeOf(value=UnknownFormat.class) public @interface Format
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).ConversionCategory
Modifier and Type | Required Element and Description |
---|---|
ConversionCategory[] |
value
An array of
ConversionCategory , indicating the types of legal remaining arguments
when a value of the annotated type is used as the first argument to Formatter.format and similar methods. |
public abstract ConversionCategory[] value
ConversionCategory
, indicating the types of legal remaining arguments
when a value of the annotated type is used as the first argument to Formatter.format
and similar methods.