Un tableau d'annotations dans une annotation
Bonjour,
Je voudrais créer un type d'annotation dont la value serait un tableau d'annotation. Je parviens à créer ceci :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@interface MonAnnotation {
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@interface MesAnnotations {
MonAnnotation[] value();
}
@MesAnnotations({
@MonAnnotation,
@MonAnnotation
})
public class Test {
} |
... mais pas du tout ceci :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@interface MaPremiereAnnotation {
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@interface MaDeuxiemeAnnotation {
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@interface MesAnnotations {
Annotation[] value();
}
@MesAnnotations({
@MaPremiereAnnotation,
@MaDeuxiemeAnnotation
})
public class Test {
} |
Est-ce possible de faire en sorte que ce deuxième exemple compile ? Et si oui, comment ?
D'avance merci à qui me répondra !