• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

annotating annotations

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic