@Documented @Pattern(value="(?:[^%]|%%|(?:%(?:\\d+\\$)?(?:[-#+ 0,(<]*)?(?:\\d+)?(?:\\.\\d+)?(?:[tT])?(?:[a-zA-Z%])))*") public @interface PrintFormat
Formatter
.
Code editors that support Pattern
annotation will check
the syntax of this value automatically. It could also be especially recognized to
check whether the subsequent var-arg arguments match the expected arguments
mentioned in the pattern. E. g., consider that the following method is annotated:
void myprintf(@PrintFormat String format, Object... args) {...}
In this case, code editors might recognize that the following call is erroneous, and issue a warning:
myprintf("%d\n", "hello"); // warning: a number expected instead of "hello"
Pattern
Copyright © 2024. All rights reserved.