【发布时间】:2021-06-22 14:21:06
【问题描述】:
我想知道我可以从其他注释变量传递注释变量。让我用一个例子来解释一下:
主要注释:
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@Example2(value = Example1.other)
public @interface Example1
{
String[] other() default {};
}
其他注释:
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface Example2
{
String[] value() default {};
}
在 Example1 注释中,我可以从 Example1 -> 其他属性传递 Example2 -> 值吗?
【问题讨论】:
标签: java annotations