动态类注解 [英] 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
推荐答案
没有。注释是静态类级别的信息,他们不能被实例字段的(不,他们不能静态字段的值的影响其一)。
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).
这篇关于动态类注解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文