Reputation: 417
Is there any way to force an annotation on another annotation on compile time?
My goal is to force "Programmer B" whenever he/she declares an annotation, to declare another annotation
So following the example below, if programmer B, declared above a method Annotation1, he must declare beneath or above it, Annotation2
code example:
@Annotation1
@Annotation2
public void method(){}
Is this even possible?
Upvotes: 1
Views: 95
Reputation: 85
You can make your own annotation like this:
@Annotation1
@Annotation2
public @interface CustomAnnotation {
}
And then use @CustomAnnotation
combining two of annotations
Upvotes: 2