Annotation Type Matches


@Target({PARAMETER,METHOD})
@Retention(SOURCE)
public @interface Matches
Specify an error-prone Matcher 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);
   }
 }
 
  • Required Element Summary

    Required Elements
    Modifier and Type Required Element Description
    Class<? extends Matcher<? super com.sun.source.tree.ExpressionTree>> value  
  • Element Details

    • value

      Class<? extends Matcher<? super com.sun.source.tree.ExpressionTree>> value