I have used the simple annotations given to us in the JDK and by other libraries such as hibernate, but I've never written my own. Can someone help me decide if an annotation is the proper way to do this?
I want to annotate a method like this:
@MyAnnotation(5)
public void foo() {
methodThatMightTakeLongerThan5();
}
When foo takes longer than 5 seconds, print a message to my log file. Is this possible with Annotations? Is that the preferred implementation?
Going a bit further...I'd like to be able to modify the value passed to the annotation via JMX bean so that I can modify it at runtime if I want to. Is that possible/preferred?