• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why annotations came?  RSS feed

 
kenji kunoichi
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why annotations came?
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because tagging interfaces are iffy design?
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kenji kunoichi wrote:Why annotations came?

Probably because someone thought they would be useful. The tutorials may help to explain it for you; because in order to know why they were created, you first need to understand what they do.

HIH

Winston
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because tagging interfaces are iffy design?

... just to elaborate: tagging interfaces are another name for marker interfaces. See http://www.coderanch.com/how-to/java/Java-FAQ#marker for more information on those.

But annotations go beyond replacing tagging/marker interfaces. People had started to keep all kinds of metadata about classes in javadoc comments, to be processed by the XDoclet tool, or in separate XML files. Hibernate 2, for example, needed lots of metadata for each persistent class in XML config files - these could be generated by XDoclet from javadoc comments that were part of the source file, thus keeping code and metadata together. Annotations formalized this, and gave it a proper API.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!