01: package spoon.aval.annotation.structure;
02:
03: import java.lang.annotation.Retention;
04: import java.lang.annotation.RetentionPolicy;
05:
06: import spoon.aval.annotation.Implementation;
07: import spoon.aval.support.validator.UniqueInsideValidator;
08: import spoon.aval.support.validator.problemFixer.RemoveThisAnnotation;
09: import spoon.processing.ProblemFixer;
10: import spoon.processing.Severity;
11: import spoon.reflect.declaration.CtAnnotationType;
12:
13: /**
14: * Validator that states that the annotation must be unique with in the scope of annother annotation
15: * <p>
16: * If an annotation <code>@A</code> must be unique inside the annotation <code>@B</code>
17: *
18: *
19: * <pre>
20: * @Inside(C.class)
21: * @UniqueInside()
22: * @Target(FIELD)
23: * public @interface A{}
24: * </pre>
25: *
26: * @see spoon.aval.support.validator.UniqueInsideValidator
27: */
28: @Requires(Inside.class)
29: @Retention(RetentionPolicy.RUNTIME)
30: @AValTarget(CtAnnotationType.class)
31: @Implementation(UniqueInsideValidator.class)
32: public @interface UniqueInside {
33: /**
34: * Message to report when validation fails
35: */
36: String message() default "Annotation ?ann is not Unique inside ?in";
37:
38: /**
39: * Severity of the validation faliure
40: */
41: Severity severity() default Severity.WARNING;
42:
43: /**
44: * The list of {@link ProblemFixer}s to propose when the validation fails.
45: */
46: Class<? extends ProblemFixer>[] fixers() default { RemoveThisAnnotation.class };
47:
48: }
|