Java annotations for design patterns?
- by Greg Mattes
Is there a project that maintains annotations for patterns?
For example, when I write a builder, I want to mark it with @Builder.
Annotating in this way immediately provides a clear idea of what the code implements. Also, the Javadoc of the @Builder annotation can reference explanations of the builder pattern. Furthermore, navigating from the Javadoc of a builder implementation to @Builder Javadoc is made easy by annotating @Builder with @Documented.
I've being slowing accumulating a small set of such annotations for patterns and idioms that I have in my code, but I'd like to leverage a more complete existing project if it exists. If there is no such project, maybe I can share what I have by spinning it off to a separate pattern/idiom annotation project.
Update: I've created the Pattern Notes project in response to this discussion. Contributions welcome! Here is @Builder