java - Is there a way to declare an annotation attribute for *any* enum? -


After the

On the moment I am developing an annotation based binding-framework for the underway of the Java Swing Hood. Unfortunately I'm left with an annotation for JRDO button-binding. What I want to do is specify the property-name of a model that has a special value (enum). The radio-button will be selected if this property has a specific value. I want to specify the value in the annotation like this:

  @RadioButtonBinding (property = "SelectedItem", selectedValue = MyEnum.FIRST) JRadioButton firstButton @RadioButtonBinding (property = "SelectedItem", selectedValue = MyEnum.SECOND) JRadioButton secondButton However, I do not know how to declare the comment above and also  any  to allow other enum. My first estimate was this, but I have found that annotation attributes can not be generalized:   

T anemanvalue (); }

Any ideas how to solve it?

This is not the way you want it to work as you have found, You can use only plain withdrawal type in annotations. Also, cos string is not going to work because if you need to use a continuous expression for initialising the values ​​of your comment, trying to avoid these restrictions by doing stuff like that.

I think the closest you are going to get started with a string and then use the code to compare with the name () of the enum. But your type security ...

goes away

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -