• Post Reply Bookmark Topic Watch Topic
  • New Topic

java anotation  RSS feed

 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the benifit of java anotation?
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use it for configuration purposes.

I wrote a JdbcSupport API latelty, that does automatic bean mapping for a ResultSet.

As per convention, I matched the property names of the JavaBeans to the columns. For example:



would map to the sql columns firstName and lastName.

If these however do not match, for instance if the sql columns are names first_name and last_name, I used an annotation for the mapping:



I don't know if that is the best example, but I hope it makes it clear a bit.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

See Annotations in Sun's Java Tutorials.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!