Are Java annotations used for adding functionality to Java code besides just adding documentation about what’s going on in the code? What’s the most advanced/complex functionality you could add to your code through an annotation?
Are Java annotations used for adding functionality to Java code besides just adding documentation
Share
Annotation are basically not more than a tag (with optional additional data) on a class/method/field. Other code (libraries or tools) can discover these tags and execute functionality dependant on the annotations found. I don’t see a real limit on the complexity of the functionality possibly added by annotations. This can for example emulate AOP (adding functionality before or after a method with an annotation).