Design Patterns for Annotation-based APIs

With the introduction of code annotations in popular languages like Java and C#, several frameworks and platforms adopted a metadatabased API (Application Programming Interface). By using this approach, instead of extending classes, implementing interfaces or invoking configuration methods, the API demand its users to add metadata through annotations in their classes. This approach can bring several benefits, such as decoupling between API and application classes and even a gain in productivity. However, this approach uses a different paradigm from traditional object-oriented programming, and existing patterns cannot be used to define such APIs. Thus, the present work aims to document patterns that describe recurrent solutions in the usage of code annotations for the creation of APIs. Based on such patterns, it is expected that API designers will have a broader range of tools to model the interaction between an application and a programming interface.