动态类注解 [英] 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屋!
查看全文