I have my own Annotation
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Template {
Class target();
}
This Annotation is used in a simple POJO:
public class Something {
@JsonSerialize(using = TemplateSerializer.class)
@Template(target = PersonRepresentation.class)
private TemplateFoo address = new TemplateFoo() {};
}
And I have Jackson seriliazer TemplateSerializer that gets 'address' passed when serializing the object to JSON.
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