The Annotations Thread

I never cared about Annotations when they came out.

They seemed like they created a lot of work without a corresponding

payoff (see @overrides annotation).

I just read a 4 part Oracle tutorial on them and using runtime

annotations (which i didnt think you could do) and now it seems like

people might be able to use them for creative things. Anyone have

any examples?

When I did a forum search on Annotations, 6 of the first 10 posts

had 0 replies - and most were from years ago. So im not too hopeful!

But yea, ive never seen anyone talk about them in this forum?

Ive never seen a single question. Its kinda weird.

[683 byte] By [TuringPesta] at [2007-11-27 11:44:55]
# 1

I use them in my JUnit 4 tests.

~

yawmarka at 2007-7-29 17:58:49 > top of Java-index,Java Essentials,Java Programming...
# 2

Hibernate is much nicer with them.

If you've invested heavily in XDoclet you see some benefit there as well.

tsitha at 2007-7-29 17:58:49 > top of Java-index,Java Essentials,Java Programming...
# 3

Annotations play a significant role in the Swing framework that's slated for inclusion in JDK 7.

https://appframework.dev.java.net/

Here's another interesting use of annotations:

http://www.javaspecialists.eu/archive/Issue097.html

uncle_alicea at 2007-7-29 17:58:49 > top of Java-index,Java Essentials,Java Programming...
# 4

>> Here's another interesting use of annotations:

UA, thanks a lot for that article.

First, that java ternary bug is interesting. I wonder how many people

that left losing their mind, lol. We're totally at the mercy of the compiler!

I had to read that article a couple times to understand it.

I really wasnt getting it. Is this what he was doing: He annotated fields

so he could put their values in an XML form that would load them

at runtime? Thats great! That really puts the 'fun' in 'functional'. ; )

I can see how that type of thing could really supercharge Swing.

EDIT: I have to add that ive seen people use XML to describe Swing layouts

and component values before but without the Annotation framework

it was CHAOTIC to read and edit.

TuringPesta at 2007-7-29 17:58:49 > top of Java-index,Java Essentials,Java Programming...
# 5

> Annotations play a significant role in the Swing framework

> https://appframework.dev.java.net/

you know i read that great 57 page pdf presentation:

http://weblogs.java.net/blog/hansmuller/archive/ts-3399-final.pdf

hoping to see the demo on page 54. and no demo, lol, and no example code.

that was a great presentation though. i was nodding my head

yelling "amen brother" through most of it.

page 8 was funny as hell!

The whole thing just seems like a mark-up language for

describing guis though. Its seems like its something a good ide should

be doing for you anyway. Its inbetween that and writing the code yourself

it seems. Looking forward to it regardless.

TuringPesta at 2007-7-29 17:58:49 > top of Java-index,Java Essentials,Java Programming...
# 6

Waddya mean there are no annotations threads?

Isn't there a whole subforum on annotations?

...or I'm not getting something here?

jadespirita at 2007-7-29 17:58:49 > top of Java-index,Java Essentials,Java Programming...
# 7

huh. youre right. there is. its only had 117 threads in

several years, lol! thats so sad.

TuringPesta at 2007-7-29 17:58:49 > top of Java-index,Java Essentials,Java Programming...
# 8

maybe because the standard annotations don't require much discussion and hardly anyone (except the guys at JBoss working on Hibernate) bothers to actually write their own?

jwentinga at 2007-7-29 17:58:49 > top of Java-index,Java Essentials,Java Programming...
# 9

> maybe because the standard annotations don't require

> much discussion and hardly anyone (except the guys at

> JBoss working on Hibernate) bothers to actually write

> their own?

That was sort of the point of the thread though, to see how people

are using annotations. I never saw a use for them in my programming

but as evidenced by UA's links, people are doing really interesting

things with them.

TuringPesta at 2007-7-29 17:58:49 > top of Java-index,Java Essentials,Java Programming...
# 10

> maybe because the standard annotations don't require

> much discussion and hardly anyone (except the guys at

> JBoss working on Hibernate) bothers to actually write

> their own?

I do. For example I use them on a Java bean to specify column headings and widths when it's displayed as a JTable row, or coresponding database fields when loading it from a datbase query.

Now arguably this moves away from the standard wizdom re: decoupling, but it certainly streamlines development.

Annotations are very easy to define and to use at run time.

malcolmmca at 2007-7-29 17:58:49 > top of Java-index,Java Essentials,Java Programming...
# 11

We use annotations with aspectwerkz. They use annotations for aop. This way we can weave security and other stuff into our methods at runtime.

see http://aspectwerkz.codehaus.org/annotations.html for how they use annotations.

Lima

LimaBravoa at 2007-7-29 17:58:49 > top of Java-index,Java Essentials,Java Programming...
# 12

what do annotations do? could they maybe automatically start up a database on runtime? that would be wicked

Alex1989a at 2007-7-29 17:58:49 > top of Java-index,Java Essentials,Java Programming...
# 13

I don't generally like annotations because much of the time you are simply moving configuration into your code, and if you ask me that is not a good thing to do. Some annotations are useful though.

YoGeea at 2007-7-29 17:58:49 > top of Java-index,Java Essentials,Java Programming...