如何在运行时动态更新注释中的值?

时间:2014-07-30 06:51:01

标签: java annotations

以下是示例代码:

@interface MyAnnotation {
String stringValue1();

String stringValue2();
}

public class Ann{
private String requireString = "str";
@MyAnnotation(stringValue1 = "abc" , stringValue2 = "")
public String getstringValue1() 
{
    return (this.requireString);
}
}

在这里,我想通过“this.requireString”返回的值更新myAnnotation的stringValue2元素的值atbs到getStringValue()方法。

你能告诉我怎么做到这一点?

0 个答案:

没有答案