posted 19 years ago
I have a special situation where I have to annotate an existing annotation:
I am some annotations written by thirdparty:
@annot1
@annot2
@annot3
@annot4
@annot5
I am writing new annotations where one of the parameter is the above annotations.
So the new annotation would look like
@newannot(param1="value1", param2=@annot1)
I want to pass any of the above 5 annotations in param2.
But the declaration is not allowing me to do that.
public @interface newannot {
String param1();
Annotation param2(); // This is not allowed.
}
So I am forced to declare it as :
public @interface newannot {
String param1();
annot1 param2();
}
This way I have to write 5 new annotations.
Is there a way to achieve this using only one annotation.