title: How to get annotations of field in Java
body: <p>I have my own Annotation</p>
  
  <pre><code>@Target(ElementType.FIELD)
  @Retention(RetentionPolicy.RUNTIME)
  public @interface Template {
     Class target();
  }
  </code></pre>
  
  <p>This Annotation is used in a simple POJO:</p>
  
  <pre><code>public class Something {   
      @JsonSerialize(using = TemplateSerializer.class)
      @Template(target = PersonRepresentation.class)
      private TemplateFoo address = new TemplateFoo() {};
  }
  </code></pre>
  
  <p>And I have Jackson seriliazer <strong>TemplateSerializer</strong> that gets 'address' passed when serializing the object to JSON.</p>
  
  <p>I wonder how I can get the @Template Annotation given the 'address' instance?
  I'd like to gets its 'target' field and then inspect the PersonRepresentation.class </p>