Annotation Type Matches
-
@Target({PARAMETER,METHOD}) @Retention(SOURCE) public @interface Matches
Specify an error-proneMatcher
to further restrict what expressions are matched by the annotated parameter.Note: The
@Matches
annotation should only go on the@BeforeTemplate
. For example:class SingletonList { {@literal @}BeforeTemplate public <E> List<E> before({@literal @}Matches(IsNonNullMatcher.class) E e) { return Collections.singletonList(e); } {@literal @}AfterTemplate public <E> List<E> after(E e) { return ImmutableList.of(e); } }