• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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.
 
Eliminate 95% of the weeds in your lawn by mowing 3 inches or higher. Then plant tiny ads:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic