title: How to generate a method on an annotated class?
body: <p>I wanna learn and have fun with annotations. Here is my use case: I have got a bunch of classes who basically have the same role: validate a video URL against a regex (1 method) and return the corresponding embedded HTML (another method).</p>
  
  <p>The thing is the validation method is always the same. I could of course use inheritance, but I would like if it is possible to create an annotation like this:</p>
  
  <pre><code>@Target(ElementType.TYPE)
  @Retention(RetentionPolicy.??)
  @Inherited
  @Documented
  public @interface VideoProvider {
          String regex();
          int group() default 1;
  }
  </code></pre>
  
  <p>Processed like that:</p>
  
  <pre><code>//processor class
  public boolean process(Set&lt;? extends TypeElement&gt; annotations,
          RoundEnvironment roundEnv) {
      for (TypeElement annotation : annotations) {
          for (Element e :    roundEnv.getElementsAnnotatedWith(annotation)) {
              if (e.getKind().isClass()) {
                  //?????
              }
          }
      }
      return false;
  }
  </code></pre>
  
  <p>The idea would be to dynamically change the annotated classes to inject a method that performs the validation.
  Is that feasible ?</p>
  
  <p>Thanks in advance!</p>
  
  <p>Rolf</p>