aspose file tools*
The moose likes Java in General and the fly likes Avoiding hard-coded annotations such as below: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Avoiding hard-coded annotations such as below:" Watch "Avoiding hard-coded annotations such as below:" New topic
Author

Avoiding hard-coded annotations such as below:

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello,

I would like to avoid the hard-coded annotation variable such as below:



Environment:
-J2ee 1.4 (web tier only, tomcat 5.5)
-J2se 5.0

I have a context param which is located in the web.xml and that I would like to use instead of the hard-coded name above.

Can anyone help?

Julien.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
It sounds like you would need to modify the code that currently processes the annotation. Read the annotation, then check for a property that might override it, and use one or the other to do... whatever you were going to do with the annotation in the first place. Does that help?

If you can't alter the code that processes the annotations, you might instead use some sort of bytecode engineering like BCEL or ASM to alter the .class file before it's loaded, changing the annotation. That's somewhat more complicated though, so I prefer the first option if possible.
[ June 17, 2007: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Avoiding hard-coded annotations such as below:
 
Similar Threads
Preventing the hard-coding of an annotation
Using Struts templates within HTML Frameset
struts 1- list box
Help needed on Reflection
Avoiding hard-coded annotations such as below: