@Documented @Retention(value=RUNTIME) @Target(value={METHOD,ANNOTATION_TYPE}) public @interface Link
用于在同一注解中,或具有一定关联的不同注解的属性中,表明这些属性之间具有特定的关联关系。
在通过AnnotationSynthesizer使用原始注解进行合成后,
得到的合成注解在获取属性值时会根据该Link进行调整。
Link注解允许作为元注解使用,即当Link注解被注解在自定义注解时,
则该自定义注解则为Link的扩展注解/子注解,它被AnnotationSynthesizer处理时也会被认为是一个Link。
默认情况,当一个属性或类同时被多个Link或其扩展注解标记时,将只有被声明在最上方的注解会生效。
比如,现有扩展注解@LinkExtend1与@LinkExtend2,若某注解的value字段情况如下:
{@codeRelationType| 限定符和类型 | 可选元素和说明 |
|---|---|
Class<? extends Annotation> |
annotation
产生关联的注解类型,当不指定时,默认指注释的属性所在的类
|
String |
attribute
annotation()指定注解中关联的属性 |
RelationType |
type
attribute()指定属性与当前注解的属性建的关联关系类型 |
public abstract Class<? extends Annotation> annotation
public abstract String attribute
annotation()指定注解中关联的属性public abstract RelationType type
attribute()指定属性与当前注解的属性建的关联关系类型Copyright © 2022. All rights reserved.