title: Annotation applicable to specific data type
body: <p>I don't know if the question I am asking is really stupid. But here it is:</p>
  
  <p>I would like to write a custom annotation which should be applicable to a specific type. For example, if I have a class A, then I would like to have an annotation that can be applied on objects of A.</p>
  
  <p>Something like this:</p>
  
  <pre><code>@Target({ElementType.FIELD, //WHAT_ELSE_HERE_?})
  public @interface MyAnnotation {
     String attribute1();
  }
  
  public class X {
     @MyAnnotation (attribute1="...") //SHOULDN'T BE POSSIBLE
     String str;
     @MyAnnotation (attribute1="..") //PERFECTLY VALID
     A aObj1;
     @MyAnnotation (attribute1="...") //SHOULDN'T BE POSSIBLE
     B bObj1;
  }
  </code></pre>
  
  <p>Is that possible at all?</p>