Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic class annotation

I want to annotate a class dynamically to make it the more generic as possible:

public class Test<T> {

    @XmlAttribute(name = dynamicvalue)
    T[] data;

    public Test(String dynamicvalue) {
    }  
}

Is there any way to achieve something like this.

TA

like image 475
jlanza Avatar asked Mar 26 '10 11:03

jlanza


1 Answers

No. Annotations are static class-level information and they can't be influenced by the values of instance fields (no, they can't influenced by the values of static fields either).

like image 160
Joachim Sauer Avatar answered Sep 19 '22 19:09

Joachim Sauer